我尝试使用Windows窗体中的asmx服务上传文件。我在web.config中指定了最大请求长度,其中托管了asmx服务。当我尝试从托管asmx服务的Web表单上传文件时,该服务运行良好。
现在的问题是,当我尝试使用Windows窗体上传文件时,它会给我最大的请求长度错误。
Windows应用程序的app.config代码如下:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="MySiteServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="655360000" maxBufferPoolSize="5242880000" maxReceivedMessageSize="655360000"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="81920000" maxArrayLength="163840000"
maxBytesPerRead="40960000" maxNameTableCharCount="163840000" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://mysite2.mydomain.com/mysiteservice.asmx"
binding="basicHttpBinding" bindingConfiguration="MySiteServiceSoap"
contract="MySiteService.MySiteServiceSoap" name="MySiteServiceSoap" />
</client>
</system.serviceModel>
我增加了maxbufeerlenth等的大小,但它不起作用。
我尝试上传的文件大小仅为7 MB
对于较小的文件(小于1 MB),没有问题。
我想补充的另一点是我在Windows窗体中添加一项服务作为“添加服务参考向导”。
感谢任何帮助。
答案 0 :(得分:1)
这是针对请求限制的IIS配置的问题
此Q&amp; A Add row using jquery可以帮助您
这是http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits,您可在其中找到更详细的信息