Maximum request length exceeded error from ASMX call inside an asp net core application

Wojciech Rajchel | reconline AG 0 Reputation points
2024-03-22T16:07:39.28+00:00

Hello

Within an .Net 6.0 framework application I created a service reference to an old asmx webservice. It is a migration of an old webforms program. The .Net program uploads various images into the webserver. The larger images causes an Exception "Maximum request length exceeded". On the server the application is hosted inside IIS. I have configured web.config in the same way as in the old working webforms code. Still the same exception is thrown. How can I solve the issue?

trace: System.ServiceModel.FaultException: System.Web.Services.Protocols.SoapException: There was an exception running the extensions specified in the config file. ---> System.Web.HttpException: Maximum request length exceeded.

   at System.Web.HttpRequest.GetEntireRawContent()

   at System.Web.HttpRequest.get_InputStream()

   at System.Web.Services.Protocols.SoapServerProtocol.Initialize()

   --- End of inner exception stack trace ---

   at System.Web.Services.Protocols.SoapServerProtocol.Initialize()

   at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)

web.config

<?xml version="1.0" encoding="utf-8"?>

<configuration>

<system.webServer>

      <handlers>

        <add name="aspNetCore" path="" verb="" modules="AspNetCoreModuleV2" resourceType="Unspecified" />

      </handlers>

      <aspNetCore processPath=".\Myapp.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />

    <security>

      <requestFiltering>

        <requestLimits maxAllowedContentLength="1073741824" />

      </requestFiltering>

    </security>

</system.webServer>

<system.web>

    <httpRuntime maxRequestLength="1048576" executionTimeout="1200" />

  </system.web>

 

Internet Information Services
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,166 questions
{count} votes