从 Windows 窗体访问 asmx 服务会出现最大请求长度错误
我尝试从 Windows 窗体使用 asmx 服务上传文件。我在托管 asmx 服务的 web.config 中指定了最大请求长度。当我尝试从托管 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 窗体中添加一项服务作为“添加服务引用向导”。
任何帮助表示赞赏。
I try to upload a file using asmx service from windows forms. I have specified max request length in web.config where asmx service is hosted. The service works well when i try to upload a file from a web form where asmx service is hosted.
Now the issue is when i try to upload a file using windows forms it gives me max request length error.
The code of app.config of windows application is as:
<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>
I increase the size of maxbufeerlenth etc but it does not work.
The file i am trying to upload is of size 7 MB only
For smaller files (of less than 1 MB) there is no problem.
One more point i want to add is i add a service in windows forms as a "ADD SERVICE REFERENCE WIZARD".
Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是请求限制的 IIS 配置问题
此问答 使用 jquery 添加行 可以帮助您
,这是 http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits 您可以在其中找到更多详细信息
This is an issue with IIS configuration for Request Limits
this Q&A Add row using jquery helps you
and this is http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits where you find more detailed information