我写了一个传输文件的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左右的附件

评论