Select to view content in your preferred language

addAttachment on secure service using proxy returns 500 internal server error

3580
4
05-17-2016 09:13 AM
KathleenBrenkert
Occasional Contributor

If I use an non-secured feature service, it does not use the proxy and I have no problem uploading an attachment.  As soon as I use a secure feature service, I get 500 internal server error.  I'm at a complete loss.  I've called support and they are researching it.  It seems to be a problem with the proxy, possibly in how I've set it up, but I can't figure it out.  Using the dotnet proxy from esri's github. 

code below works if my service is not secure, but the fLayer I've plugged in here is secure and I get the 500 error.  Server 10.3.1, Javascript 3.13

html:

<form id="attachOne">
        <label class="file_upload">Select a file to attach:</label>
        <input type="file" name="attachment"  />
    </form>
    <input type="button" id="submitButton" value="Upload">

javascript:

require(["esri/config","esri/dijit/editing/Add", 
"esri/layers/FeatureLayer", "esri/urlUtils","dojo/dom",  "dojo/on", 
"dojo/domReady!"


], function (esriConfig, Add, FeatureLayer, urlUtils, dom, on){

    "use strict";
    

    urlUtils.addProxyRule({
                urlPrefix: "https://gis.northcharleston.org/arcgis/rest/services/Feature/OneStopShop/FeatureServer/", 
                proxyUrl:"https://gis.northcharleston.org/DotNet/proxy.ashx"
            });
    
    on(dom.byId("submitButton"), "click", uploadFile);
    
    function uploadFile(){
        var fLayer=new FeatureLayer("https://gis.northcharleston.org/arcgis/rest/services/Feature/OneStopShop/FeatureServer/0");
        fLayer.addAttachment(24404, document.getElementById("attachOne"), function(result){console.log(result);}, function(errorMessage){console.log(errorMessage);});
        
    }
    
    
, function(errorMessage){console.log(errorMessage);});
        
    }
    
0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus

Kathleen,

And you have a serverUrl added in your proxy.config for "https://gis.northcharleston.org​" right?

0 Kudos
KathleenBrenkert
Occasional Contributor

Yes, the proxy works as far as loading my secure service to a map and applying edits. It wasn't until I attempted to attach files that I started getting the error.

Sent from my iPhone

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Kathleen,

  There must be an issue with the proxy not doing the attachment requests through the proxy then. Sorry I can not bee of more help.

0 Kudos
KathleenBrenkert
Occasional Contributor

Thanks for trying, I’m not having any luck with support yet either.

0 Kudos