Search code examples
.netweb-servicesiis-7large-file-upload

How do I upload large (> 25MB) files to a web service?


I have a web service that takes a byte[] and saves it.

This works fine for "small" files, but once I hit a certain size the web service fails and returns "The request failed with HTTP status 404: Not Found."

From what I've seen this appears to be an IIS setting that limits the size of a file that can be posted (to prevent Denial of Service attacks). I've tried to increase that setting, but I am having trouble determining what setting and where/how one would set it. I am using IIS7 and the webservice is done in .net (asmx).

In the web.config of the web service I have added the following (which seemed to increase the size of file that can be accepted, but not all the way to this setting size)

  <system.web>
     <httpRuntime executionTimeout="999999" maxRequestLength="2097151" />
     ...
  </system.web>

Any suggestions on where (and how) to increase the size of file that the web service would be greatly appreciated.


Solution

  • In addition to the httpRuntime/maxRequestLength mentioned in the question, it looks like there is an additional item that can be added to the web service's web.config file to permit large file transfers.

      <system.webServer>
        <security>
          <requestFiltering>
            <requestLimits maxAllowedContentLength="2000000000" />
          </requestFiltering>
        </security>
      </system.webServer>
    

    This appears to enable larger files to be uploaded via web services.