I have a SOAP service created using C# in Visual Studio 2017 compiled with .NET 4.0 framework.
I deploy the service to IIS Express when debugging and to a IIS manager Site. On both services I'm running into the following error when I post a XML with a (big) Base64 encoded string (a PDF file) of 8.1 million characters:
System.Web.Services.Protocols.SoapException:
Server was unable to process request.
Object reference not set to an instance of an object.
at System.Web.Services.Protocols.SoapServerProtocolHelper.GetRequestElement() at System.Web.Services.Protocols.Soap12ServerProtocolHelper.RouteRequest() at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
I've already tried increasing the "Maximum allowed content length" to about 3GB in both the web.config
file and the applicationhost.config
file. This had no influence, but I also did not expect any result there because the error does not actually state that it has a problem that the content is too big.
When I post the same XML with another Base64 string which is a lot smaller it does create a correct Object from the XML without any problems.
I've also checked if the Base64 string is correct with multiple online converters. They also had a lot of problems with the size, but I could confirm the string.
The strange thing is that when debugging it does not even go into the WebService class.
By the way the field in code is a byte array and in the XSD defined as base64Binary.
I cannot share the Base64 string itself, because it has sensitive information in this case and also because it's size.
How can I solve this issue?
UPDATE Also tried setting "User the 64 bit version of IIS Express for web sites and projects", but this didn't help eather.