正文

关于WebService最大的请求问题2007-03-20 13:55:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/Csharpsky/24134.html

分享到:

我写了一个传输文件的WebService
当我传一个大于3MB的XML文件时出现如下错误:
System.Web.Services.Protocols.SoapException: 在运行配置文件中指定的扩展时出现异常。 ---> System.Web.HttpException: 超过了最大请求长度。
at System.Web.HttpRequest.GetEntireRawContent()
at System.Web.HttpRequest.get_InputStream()
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
--- 内部异常堆栈跟踪的结尾 ---
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
3MB以下的XML文件是OK的,是不是WebService有最大请求限制
能不能把这个限制改大一点呢
帮帮我呀!

在Web.config和App.config中加入
<microsoft.web.services2>
<messaging>
<maxRequestLength>628000</maxRequestLength>
</messaging>
<diagnostics />
</microsoft.web.services2>
maxRequestLength里填入你想要的大小kb为单位
详见 :http://calmzeal.cnblogs.com/archive/2006/01/05/311429.html

 

那就配置这个:
<configuration>
<system.web>
<httpRuntime maxRequestLength="4096" executionTimeout="60" appRequestQueueLimit="100"/>
maxRequestLength和上面的一样
 
我后面说的你试过没
应该就是这样
因为Asp.Net为了防止DDos攻击
默认只允许上传4m左右的附件

阅读(7477) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册