2

I have a web application that calls an ArcGIS 10.2.2 secure print service (accesses secured map services). I am calling the print service using a proxy page. Generally this works, but after roughly 30 minutes the print request fails for no apparent reason, and the ArcGIS Server logs contain the following:-

    Error executing tool.: Layer "internal": Unable to connect to map server at 
    http://myserver:6080/arcgis/rest/services/Internal/Cadastral/MapServer. 
    Layer "jobs": Unable to connect to map server at 
    http://myserver:6080/arcgis/rest/services/Internal/General/MapServer. 
    Layer "wells": Unable to connect to map server at 
    http://myserver:6080/arcgis/rest/services/Internal/Oil_and_Gas/MapServer. 
    Failed to execute (ExportWebMap). Failed to execute (Export Web Map).

The error reported back from the http request is:

Error: Unable to complete operation

The rest of the application works perfectly. If I try printing later (say 20mins), or if I restart the Print Service Tool, it happily prints again for another ~30 mins. It is as if a connection is timing out. Token expiring? Has anyone had this problem before, or can someone suggest where I should direct my attention?

  • This is only happening when I select layers from secured map services. If I print (export map) using only unsecure map services then it works. It's as if the Print Service loses its connection to the map services and cannot reconnect without being restarted. – tr3v Jul 1 '14 at 2:53
  • I wonder if this bug is the problem. In my case, it works for a period of time, but I cannot workout why and when the connection is lost. – tr3v Jul 1 '14 at 3:45
  • I tried appending a token to the map service URL in the operationalLayers, but this never works either. Maybe in your case its working sometimes because you are logged into AGS via manager, thus you have access to the service for 30 mins or whatever the timeout is on the token. – user714157 Oct 7 '14 at 22:20
  • Are your serves in a clustered environment with a web adapter? – user714157 Oct 10 '14 at 18:52
  • No, we do have a web adaptor for external sites but I was testing directly on port 6080 – tr3v Oct 11 '14 at 20:13
2

I've just experienced this problem too, in ArcGIS Server 10.3. As @rdeschain suspected, it's to do with the token timeout, so one option is to increase that value. I tested this by reducing it to 2 minutes and restarting the service, and sure enough, it stopped working after 2 minutes.

The other thing you can do is decrease the recycle interval for the geoprocessing service (in the service properties, under Processes). I've set my short-term token timeout to 360 minutes and my recycle interval to 6 hours.

I'll report back if this isn't the answer, but I suspect this might do it.

1

Recently upgraded from 10.1 to 10.2.2 and ran into the same issue. Talked to ESRI support, but they could not reproduce the problem.

My print service stops working after ~1hr which corresponds to the duration of my short-term token. Try increasing the duration of your short-term token. I increased mine to 24hrs since my services are restarted nightly. I'm still testing but so far so good. Not ideal, but a potential workaround.

0

I've been trying to do the same thing. Asked an ESRI tech support about this and they said to take a look at this document -

http://resources.arcgis.com/en/help/main/10.2/index.html#/Printing_maps_that_contain_secured_services/0154000005q3000000/

EDIT

The problem for us was that we have have a clustered server environment and we were 1) not using the correct certificates and 2) using the mapServer URL's of the machines in the cluster instead of the URL's of the web adapter.

  • 4
    BTW, I followed ESRI's instructions and still cant access the secure service. Typical ESRI. – user714157 Oct 8 '14 at 17:15
  • Yes, have read this document many times. My original post and problem still stands. – tr3v Oct 8 '14 at 19:13
0

It appears as though if you can upgrade to 10.3 they have addressed some of the issues of printing a secured service. You can review the ArcGIS 10.3 Issues Addressed List. enter image description here

0

well.. I was struggling with this problem almost for a year now. I just came up with a workaround. The only thing you need to do is to generate a Short-lived Token every time your page loads. I did it in my Login Page and put it in Session. I try to explain it step by step:

1-Generating a short-lived Token

  • As you may know, Printing Tasks wont work with Long-lived tokens and Short-Lived Tokens will expire after a while ( you can set the lifespan in ArcgisManager/Security ) . So you have to Generate Short-lived token server-side and save it in session.DONT DO IT CLIENT-SIDE(because you will expose the credentials and what's the point of securing the map in the first place!?). Here you can find how to generate tokens server-side C# - Access content from ArcGIS Online

    2-Applying the short-lived token

  • To avoid the Arcgis authentication windows dialog you have to setup your proxy.config and apply it to your esriconfig :

       esriConfig.defaults.io.proxyUrl = "proxy/proxy.ashx";
       esriConfig.defaults.io.alwaysUseProxy = true;
    
  • Then append the token to the end of your ArcGISDynamicMapServiceLayer address:

        var GeneratedToken = document.getElementById("HiddenTokenTB").value;
        var dynamiclayersURLForPrint = AGS_SERVICE_PREFIX + "/" + MAP_SERVICE_NAME + "/MapServer" + "?token=" + GeneratedToken;
    

    EDIT : I should say that you should make a Map object just for printing( with the token ). Dont add the token to the map you are showing( that will mess up your legend and TOC ). when you are trying to Print the map , just pass the Map object that you made for printing.

Get the extent of the original map first.

printmap.extent = map.extent;

printer = new Print({
              map: printmap,
              templates: [template],
              url: printUrl
          }, dom.byId("printButton"));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.