|
POST
|
Using AGS 10.6 I've read a lot of GeoNet posts on this but I'm still running into issues. I'm sure it has something to do with permissions but I'm using the same domain account for ArcGIS Server Account and an administrator with full control on my publishing machine. First, the publishing machine and the server machine are not the same machine. Publishing machine is the regular old computer where I publish services through ArcGIS Desktop. AGS is on a server I connect to remotely. I have successfully registered SDE geodatabases with database authentication with the server so I'm not sure if firewalls are a problem? After running lusrmgr.msc on my publishing machine, I can see my domain user in the Administrator group. I am trying to access folders in the 😧 drive, so I check that the administrator group has full control there. Note I have also checked that the administrator group also has full control over the exact folder I want to register; it does. The ArcGIS Server Account has been configured with the same domain. I am logged into the server machine as this user also: This is how I'm trying to register the folder from Desktop: I do not have a 😧 drive on the server machine, could that be the issue? I only have a C: drive. Do I need to use a UNC path (if so, do you have an example of what it would be? I've never used one before)? Error I get:
... View more
11-01-2018
08:17 AM
|
0
|
14
|
5277
|
|
POST
|
Ok, probably a dumb question, but how would I package the two MXDs up with the GP service for publishing? Or do I just copy the MXDs and place them into the arcgisinput folder directly? I have tried registering the folder without success. I'm sure it has to do with permissions but I can't determine what's wrong with them. The publishing machine and the server machine are different. My ArcGIS Server Account is a domain account and that same domain account is an administrator on the publishing machine and has full control over the 😧 drive but for some reason it won't let me access the folder where the MXDs are kept (D:\GIS_Testing\PrintTesting\mapdoc.mxd). I have attempted moving that folder to the C:\Users drive but no luck there either.
... View more
11-01-2018
07:54 AM
|
0
|
1
|
1443
|
|
POST
|
So, when setting parameter as text, you have to make sure the output is actually a string. In my case it was not, so the script should look like this: arcpy.SetParameterAsText(7, str(outputPDF))
... View more
11-01-2018
07:01 AM
|
0
|
0
|
2609
|
|
POST
|
I think I have all my indexing correct. I have 8 parameters in my script tool. 7 input and 1 derived output. Indexing for GetParameterAsText starts at 0, so logically my SetParameterAsText should have an index of 7, considering my output parameter is the last one in the list. I use sys.argv to set my input parameters in the script. This index starts at 1. My script: #Get all the inputs from the user
year = sys.argv[1] #GetParameterAsText(0)
state = sys.argv[2] #GetParameterAsText(1)
cipArea = sys.argv[3] #GetParameterAsText(2)
layerString = sys.argv[4] #GetParameterAsText(3)
renderer = sys.argv[5] #GetParameterAsText(4)
orientation = sys.argv[6] #GetParameterAsText(5)
emailAddr = sys.argv[7] #GetParametersAsText(6)
#Do a ton of stuff
outputPath = os.path.join(arcpy.env.scratchFolder, "Map.pdf")
outputPDF = arcpy.mapping.ExportToPDF(mxd, outputPath)
arcpy.SetParameterAsText(7, outputPDF) How the output parameter is set (there are 8 parameters, I just can't expand the window to show them all): Input window (don't mind the x's): Anybody know what could be happening? This is the error I get back: Traceback (most recent call last): File "D:\NET_Projects\HabitatMapGPServices\PrintHabitatMaps\PrintHabitatMaps.py", line 234, in <module> arcpy.SetParameterAsText(7, outputPDF) File "c:\program files (x86)\arcgis\desktop10.6\arcpy\arcpy\__init__.py", line 670, in SetParameterAsText return gp.setParameterAsText(index, text) File "c:\program files (x86)\arcgis\desktop10.6\arcpy\arcpy\geoprocessing\_base.py", line 231, in setParameterAsText self._gp.SetParameterAsText(*gp_fixargs(args, True))) AttributeError: Object: Error in parsing arguments for SetParameterAsText
... View more
11-01-2018
06:02 AM
|
0
|
3
|
2878
|
|
POST
|
I have an eventual GP service that takes an MXD, alters it based on user input, and then exports it to a PDF to return to the user. I know when the MXDs get published to the server, they'll be located in this folder: C:\arcgisserver\directories\arcgissystem\arcgisinput\PrintService\Print.MapServer\extracted\v101\MyFile.mxd In the script, how should I reference where those MXDs are? I don't think it's best practice to hardcode something like that, is it? If I were to use the below script, would the path "D:\GIS_Testing\...." be replaced with an ESRI variable once it's published to Server? I'm just not sure how to define it so it can find the MXDs once it's up on my server. arcpy.env.workspace = r'D:\GIS_Testing\HabitatDbase\PrintTesting'
#Get the map document to manipulate based on whether the user wants a portrait or a landscape layout map
if orientation == "Portrait":
mxd = arcpy.mapping.MapDocument(os.path.join(arcpy.env.workspace, 'PortraitLayout.mxd'))
else:
mxd = arcpy.mapping.MapDocument(os.path.join(arcpy.env.workspace, 'LandscapeLayout.mxd')) For what it's worth, I write the output file to scratchFolder, which I believe is fine: outputPDF = arcpy.mapping.ExportToPDF(mxd, os.path.join(arcpy.env.scratchFolder, "Map.pdf"))
arcpy.SetParameterAsText(7, outputPDF)
... View more
10-31-2018
11:12 AM
|
0
|
3
|
1618
|
|
POST
|
Alright... I have no idea what happened or what I did differently but on the 500th try it started working. If you're searching for proxy answers, read this entire thread because my code changed A LOT between beginning post and this one. The only things I can think of for final changes was that I changed the path to my log file to be accurate in the Web.config file (probably has no bearing on this working). I also changed the other GP service to the have the correct, more general URL (I hadn't earlier because I wasn't testing that service). The last "change" was just republishing my application. Again, no clue what made it start working but something did! Thanks for your help with all of this. Final code: JS urlUtils.addProxyRule({
urlPrefix: "https://www.mydomain.com",
proxyUrl: "/appName/proxy/proxy.ashx"
}); proxy.config <ProxyConfig allowedReferers="https://www.mydomain.com/*"
mustMatch="true"
logFile="proxyLog.txt"
logLevel="Warning">
<serverUrls>
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatManagement/HabitatManagement/GPServer/"
username="username"
password="password"
matchAll="true"/>
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatMonitoring/HabitatData/MapServer"
username="username"
password="password"
matchAll="true" />
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatMonitoring/HabitatClassification/GPServer/"
username="username"
password="password"
matchAll="true" />
</serverUrls>
</ProxyConfig>
... View more
10-25-2018
05:16 PM
|
1
|
1
|
8240
|
|
POST
|
Went to my rest services page and checked them against the URLs. Case is correct as well as spelling. I can't take down my server right now so I'm going to try debugging proxy.ashx file tonight when no one should be using it. Need to see what the incoming URI looks like. The 403 error message above I edited because I thought it was just the way the error message was structured in the proxy.ashx file and it was repeating that big long URL twice, but I checked how the error message should look and it should only be there once I think, so I think my URI is coming in weird. The full error message was actually this: {"error": {"code": 403,"message":"Proxy has not been set up for this URL. Make sure there is a serverUrl in the configuration file that matches: https://www.mydomain.com/myServer/rest/services/HabitatManagement/HabitatManagement/GPServer/HabitatManagement/submitJob?f=json&Input_Zip_File=%7B%22itemID%22%3A%22ib98735f1-f9d7-4858-a723-1e2dbec6acd7%22%7D&State_Abbreviation=PA&Email_Address=xxx%40xxx.xxxhttps://www.mydomain.com/myServer/rest/services/HabitatManagement/HabitatManagement/GPServer/HabitatManagement/submitJob?f=json&Input_Zip_File=%7B%22itemID%22%3A%22ib98735f1-f9d7-4858-a723-1e2dbec6acd7%22%7D&State_Abbreviation=PA&Email_Address=xxx%40xxx.xxx } } I checked my JS code and there's no way it can submit a job twice (and even if it did, the "Input_Zip_File" parameter would be different since the itemID changes on every submit), so something really funky is happening. Edit: Nevermind, the error message is structured correctly with the repeated URL.
... View more
10-25-2018
07:18 AM
|
0
|
0
|
3157
|
|
POST
|
Then I must have something else wrong since it is not matching even when set to true with a url like the one you just posted. I'm going to make a post on the GitHub page and if I'm lucky maybe the person managing it will actually respond.
... View more
10-25-2018
06:37 AM
|
0
|
2
|
3157
|
|
POST
|
Sorry, that was just an oversight on my part when I was typing it in. I do have the /rest/services in my code. Alright, I'll probably just have to use that generalized URL as a workaround for the time being.
... View more
10-25-2018
05:46 AM
|
0
|
4
|
3157
|
|
POST
|
I am so so close to having this figured out but wonder if you have any ideas on the last issue I am facing. I have gotten past the issues I was having before, I can now load my map services and successfully upload a file through my geoprocessing service with the app authenticating on behalf of itself using the proxy. The last issue I am facing is that my geoprocessing service takes in parameters, these parameters change with every submission, which means the "submitJob" URL will change every time the geoprocessing service is called upon. I have no idea how to make a server URL to handle that in proxy.config... I was looking at the "matchAll" setting for serverUrls and have tried both true and false to see if it really would forward anything that begins with the specified URL (apparently when it's set to "true" it's supposed to do this) but it doesn't. I can't specify the exact URL as it changes every time and if I just specify "www.mydomain.com" it becomes too general... Current proxy.config <ProxyConfig allowedReferers="https://www.mydomain.com/*"
mustMatch="true"
logFile="proxyLog.txt"
logLevel="Warning">
<serverUrls>
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatManagement/HabitatManagement/GPServer/uploads/upload"
username="username"
password="password"
matchAll="true"/>
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatMonitoring/HabitatData/MapServer"
username="username"
password="password"
matchAll="true" />
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatMonitoring/HabitatClassification/GPServer/uploads/upload"
username="username"
password="password"
matchAll="true" />
</serverUrls>
</ProxyConfig> I have tried adding something like this to proxy config which didn't work (no matter if matchAll is true or false): <serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatManagement/HabitatManagement/GPServer/HabitatManagement/submitJob"
username="username"
password="password"
matchAll="true" /> I've also tried editing the GPServer URLs to be more general like the MapServer one with no luck: <serverUrl
url="https://www.mydomain.com/myServer/HabitatManagement/HabitatManagement/GPServer"
username="username"
password="password"
matchAll="true" /> This is the kind of error I receive in the console: {"error": {"code": 403,"message":"Proxy has not been set up for this URL. Make sure there is a serverUrl in the configuration file that matches: https://www.mydomain.com/myServer/rest/services/HabitatManagement/HabitatManagement/GPServer/HabitatManagement/submitJob?f=json&Input_Zip_File=%7B%22itemID%22%3A%22ib98735f1-f9d7-4858-a723-1e2dbec6acd7%22%7D&State_Abbreviation=PA&Email_Address=xxx%40xxx.xxx This is how the JS code ended up, turns out I needed to add the appName to the relative path of the proxy: urlUtils.addProxyRule({
urlPrefix: "https://www.mydomain.com",
proxyUrl: "/appName/proxy/proxy.ashx"
});
... View more
10-24-2018
05:49 PM
|
0
|
0
|
3157
|
|
POST
|
I have set up a proxy so my services can be secured and users don't need to login to the application, it just authenticates in the background with a token (users log into an application that the javascript api map sits inside of, so no need to log in again). The map server services work great, my data shows up as it should and everything works as expected. However, I cannot get my geoprocessing services to upload files because the input parameters (i.e. job ID) change with every submission so I don't know how to get the serverUrls in the proxy.config file to match. The documentation for the proxy settings in the config file also contradicts itself: url: Location of the ArcGIS Server service (or other URL) to proxy. Specify either the specific URL or the root (in which case you should set matchAll="false"). matchAll="true": When true all requests that begin with the specified URL are forwarded. Otherwise, the URL requested must match exactly. I would assume if it's the root URL you'd want to set matchAll to true so it'll match anything after the root. The "url" setting says the opposite what the matchAll setting says... either way, I've tried setting matchAll to both true and false and neither work. I still get errors like this in the console when trying to submit my file for upload to my GP service: {"error": {"code": 403,"message":"Proxy has not been set up for this URL. Make sure there is a serverUrl in the configuration file that matches: https://www.mydomain.com/myServer/rest/services/HabitatManagement/HabitatManagement/GPServer/HabitatManagement/submitJob?f=json&Input_Zip_File=%7B%22itemID%22%3A%22i5d997ada-4aa9-4a68-8321-1170446ed463%22%7D&State_Abbreviation=PA&Email_Address=xxx%40xxx.xxx Current JS code: urlUtils.addProxyRule({
urlPrefix: "https://www.mydomain.com",
proxyUrl: "/appName/proxy/proxy.ashx"
}); Current proxy.config file: <ProxyConfig allowedReferers="https://www.mydomain.com/*"
mustMatch="true"
logFile="proxyLog.txt"
logLevel="Warning">
<serverUrls>
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatManagement/GPServer/uploads/upload"
username="username"
password="password"
matchAll="true"/>
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatMonitoring/HabitatData/MapServer"
username="username"
password="password"
matchAll="true" />
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatMonitoring/HabitatClassification/GPServer/uploads/upload"
username="username"
password="password"
matchAll="true" />
</serverUrls>
</ProxyConfig>
... View more
10-24-2018
05:06 PM
|
0
|
0
|
1328
|
|
POST
|
Right, which is why I thought I needed to change the urlPrefix in the JS to include the appName on the end of it. However, when I do that I just get a log in prompt on my web page. I will investigate more tomorrow, burnt out on this today. Thank you for all your help!! You got me a heck of a lot closer to how it needs to work.
... View more
10-23-2018
01:54 PM
|
0
|
0
|
3157
|
|
POST
|
Back to "resources not found" errors when trying to load the map services. No log in window. GET https://www.mydomain.org/proxy/proxy.ashx?https://www.mydomain.org/myServer/rest/services/HabitatMonitoring/HabitatData/MapServer/1?f=json 404 (Not Found) Config: <ProxyConfig allowedReferers="https://www.mydomain.com/*"
mustMatch="true"
logFile="proxyLog.txt"
logLevel="Warning">
<serverUrls>
<serverUrl url="https://www.mydomain.com/appName/HabitatMap/HabitatJSMap"
username="username"
password="password"
matchAll="true" />
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatManagement/HabitatManagement/GPServer/HabitatManagement"
username="username"
password="password"
matchAll="true"/>
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatMonitoring/HabitatData/MapServer"
username="username"
password="password"
matchAll="true" />
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatMonitoring/HabitatClassification/GPServer/HabitatClassification"
username="username"
password="password"
matchAll="true" />
</serverUrls>
</ProxyConfig> JS: //Set up the proxy to forward requests for data/geoprocessing tools
urlUtils.addProxyRule({
urlPrefix: "https://www.mydomain.com",
proxyUrl: "/proxy/proxy.ashx"
}); Would the way the feature layers are defined possibly pose a problem? I swear I've seen people having trouble with definition expressions and proxies for some reason. Granted I don't know why that would produce 404 errors. Seems unlikely. //Add the habitat patches feature layer
var patchesFL = new FeatureLayer("https://www.mydomain.com/myServer/rest/services/HabitatMonitoring/HabitatData/MapServer/2", {
mode: FeatureLayer.MODE_ONDEMAND,
autoGeneralize: false,
refreshInterval: 10,
visible: false,
infoTemplate: patchesPopupBox,
outFields: ["*"]
});
patchesFL.setMinScale(500000);
patchesFL.setSelectionSymbol(selectionSym);
patchesFL.setDefinitionExpression('ReportingYear = ' + currentYear);
... View more
10-23-2018
01:12 PM
|
0
|
3
|
2417
|
|
POST
|
My bad, I didn't publish my app quite right after changing the JS, so I redid it and now I get the log in prompt again (no "resource not found" errors). Just to clarify everything... Current JS: //Set up the proxy to forward requests for data/geoprocessing tools
urlUtils.addProxyRule({
urlPrefix: "https://www.mydomain.com/appName",
proxyUrl: "/proxy/proxy.ashx"
});
Current config: <ProxyConfig allowedReferers="https://www.mydomain.com/*"
mustMatch="true"
logFile="proxyLog.txt"
logLevel="Warning">
<serverUrls>
<serverUrl url="https://www.mydomain.com/appName/HabitatMap/HabitatJSMap"
username="username"
password="password"
matchAll="true" />
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatManagement/HabitatManagement/GPServer/HabitatManagement"
username="username"
password="password"
matchAll="true"/>
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatMonitoring/HabitatData/MapServer/0"
username="username"
password="password"
matchAll="true" />
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatMonitoring/HabitatData/MapServer/1"
username="username"
password="password"
matchAll="true" />
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatMonitoring/HabitatData/MapServer/2"
username="username"
password="password"
matchAll="true" />
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatMonitoring/HabitatData/MapServer/3"
username="username"
password="password"
matchAll="true" />
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatMonitoring/HabitatData/MapServer/4"
username="username"
password="password"
matchAll="true" />
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatMonitoring/HabitatData/MapServer/5"
username="username"
password="password"
matchAll="true" />
<serverUrl url="https://www.mydomain.com/myServer/rest/services/HabitatMonitoring/HabitatClassification/GPServer/HabitatClassification"
username="username"
password="password"
matchAll="true" />
</serverUrls>
</ProxyConfig>
... View more
10-23-2018
12:31 PM
|
0
|
5
|
2417
|
|
POST
|
Alright. I have all the services in the config file. Now, no login prompts, however no data on the map either. I am getting a lot of "resource not found" in the console. Network tab snippet: When I go look in the header and response for details, this is in the response: <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1> <h2> <i>The resource cannot be found.</i> </h2></span> <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "> <b> Description: </b>HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. <br><br> <b> Requested URL: </b>/proxy/proxy.ashx<br><br> So it seems like it can't find the proxy URL which suggests that my JS code needs to be altered in some way, right? I changed my proxyUrl to be an absolute path but that has not changed anything. //Set up the proxy to forward requests for data/geoprocessing tools
urlUtils.addProxyRule({
urlPrefix: "https://www.mydomain.com/",
proxyUrl: "https://www.mydomain.com/appName/proxy/proxy.ashx"
}); I have also tried this because I'm not entirely sure what the urlPrefix does: //Set up the proxy to forward requests for data/geoprocessing tools
urlUtils.addProxyRule({
urlPrefix: "https://www.mydomain.com/appName",
proxyUrl: "/proxy/proxy.ashx"
});
Given where the proxy sits in the application, I think the proxy would be located at https://www.mydomain.com/appName/proxy/proxy.ashx. The proxy folder sits under the root folder "appName" in my visual studio solution explorer which creates all the URLs and what not.
... View more
10-23-2018
12:19 PM
|
0
|
7
|
2417
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-18-2020 10:31 AM | |
| 2 | 09-16-2025 02:17 PM | |
| 3 | 09-12-2025 09:26 AM | |
| 1 | 08-16-2023 05:11 PM | |
| 1 | 02-27-2024 06:48 AM |
| Online Status |
Offline
|
| Date Last Visited |
09-16-2025
02:16 PM
|