Hi All,
I had installed an IIS on Windows server 2008 R2 , and hosted an wcf service.
I had created a self signed certificate and using a secure http connection to access service.
I am using service to upload images from mobile devices to server.
The small size image is uploading to server (image size < 1000KB) , it the size exceeds 1MB limit the service call is through an error.
Here is a service call method :
jsonText = JSON.stringify({"ImageData":ImageData});
var url = getURL()+"UplodImage";
var xhr = createCORSRequest('POST', url);
if (!xhr) {
alert('CORS not supported');
}
xhr.onload = function () {
var data = JSON.parse(xhr.responseText);
};
xhr.onerror = function() {
alert('Woops, there was an error making the request.');
};
xhr.setRequestHeader('Content-Type', 'application/json') ;
xhr.send(jsonText);
}
Always for large file size I am getting an "xhr.onerror()" error message.
What may be the issue here?
I had also tried with HTTP service, with HTTP service images were uploading to server, So it there any extra settings required to do for HTTPS ?
Here is configuration file from Wcf service :
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="webHttpBindingClient" closeTimeout="00:50:00" openTimeout="00:50:00" receiveTimeout="00:50:50" sendTimeout="00:50:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Buffered" useDefaultWebProxy="true" crossDomainScriptAccessEnabled="true">
<readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647"/>
<security mode="Transport"/>
</binding>
</webHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="ServiceBehaviour" name="Service">
<endpoint address="" behaviorConfiguration="EndpBehaviour" binding="webHttpBinding" bindingConfiguration="webHttpBindingClient" name="webHttpEndPointBinding" contract="IService"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<serviceMetadata httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="EndpBehaviour">
<webHttp helpEnabled="true"/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint crossDomainScriptAccessEnabled="true"/>
</webHttpEndpoint>
<webScriptEndpoint>
<standardEndpoint crossDomainScriptAccessEnabled="true"/>
</webScriptEndpoint>
</standardEndpoints>
</system.serviceModel>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*"/>
<add name="Access-Control-Allow-Credentials" value="true"/>
<add name="Access-Control-Allow-Methods" value="POST, GET,OPTIONS"/>
<add name="Access-Control-Max-Age" value="600000"/>
<add name="Access-Control-Allow-Headers" value="content-type,Accept"/>
<add name="Content-Type" value="application/json;charset=UTF-8"/>
<add name="Allow" value="OPTIONS, TRACE, GET, HEAD, POST"/>
</customHeaders>
</httpProtocol>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="20971520" />
</requestFiltering>
</security>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
Thanks in advance for your suggestions.
--Avinash