如何将大 (> 25MB) 文件上传到 Web 服务?

How do I upload large (gt; 25MB) files to a web service?(如何将大 ( 25MB) 文件上传到 Web 服务?)

本文介绍了如何将大 (> 25MB) 文件上传到 Web 服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网络服务,它接受一个字节[]并保存它.

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

这适用于小"文件,但一旦达到一定大小,Web 服务就会失败并返回请求失败,HTTP 状态 404:未找到."

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."

据我所见,这似乎是一个 IIS 设置,它限制了可以发布的文件的大小(以防止拒绝服务攻击).我试图增加该设置,但我无法确定设置什么以及在哪里/如何设置它.我正在使用 IIS7,并且 web 服务是在 .net (asmx) 中完成的.

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).

在 web 服务的 web.config 中,我添加了以下内容(这似乎增加了可以接受的文件大小,但不是一直到这个设置大小)

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>

任何关于在何处(以及如何)增加 Web 服务文件大小的建议将不胜感激.

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

推荐答案

除了问题中提到的httpRuntime/maxRequestLength,貌似还有一个额外的项可以添加到web服务的web.config文件中允许大文件传输.

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.

这篇关于如何将大 (> 25MB) 文件上传到 Web 服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何将大 (> 25MB) 文件上传到 Web 服务?

基础教程推荐