1

我正在使用 WSE Web 服务在 c# 中开发客户端-服务器应用程序。用户可以做的一件事是通过网络服务将 jpg 图像发送到服务器进行备份。最近发生了奇怪的错误。并非所有用户都会发生这种情况,只有少数用户会发生这种情况。在客户端,例外是

System.Net.WebException Exception message: The operation has timed out

并在服务器上的事件查看器中发现以下警告:

Exception information:      
Exception type: HttpException
Exception message: Server cannot clear headers after HTTP headers have been sent.
Request information
Request URL: MyUrl/Service.asmx
Request path: /MyWebService/Service.asmx
User host address: -------
User:
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE
Thread information:
Thread ID: 7
Thread account name: NT AUTHORITY\NETWORK SERVICE
Is impersonating: False
Stack trace: at System.Web.HttpResponse.ClearHeaders()
at System.Web.Services.Protocols.SoapServerProtocol.WriteException(Exception e, Stream outputStream)
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
at System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response)

有谁知道这个错误可能来自哪里?我已经尝试将 web.config 中的“maxRequestLength”提高到 16Mb,但这并不能解决问题。

问候/丹尼尔

4

2 回答 2

0

我也经历过同样的事情。当我研究这个问题时,我遇到了这个问题。我只是想分享我到目前为止发现的东西。

我在网上找到的很简单。通过在 web.config 文件的 system.web 部分中增加 maxRequestLength(到合理的数量),您可以解决此问题。

我想,在没有做更多研究的情况下,当您的一个用户通过 WSE Web 服务发送更大的 JPG 以在您的系统中备份时,您的 maxRequestLength 的默认设置将无法处理呈现的请求的大小。

您可能还希望为您的 executionTimeout 设置添加时间。

于 2010-04-08T15:59:15.167 回答
0

您是否因为别无选择而使用 WSE?这确实是使用它的唯一原因,因为它已经过时了。您无法使用 WCF 吗?

于 2009-07-13T06:46:59.933 回答