2009-12-17 64 views
0

我们有一个在IIS中运行的ASP.NET Web应用程序,它使用SoapHttpClientProtocol类来进行SOAP调用。在最近几天,几个XP机器在进行SOAP服务调用时已经开始报告超时错误。来自IIS 5.1(XP)的SOAP服务调用超时

堆栈跟踪从一个测试应用程序:

System.Net.WebException: The operation has timed out 
    at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request) 
    at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request) 
    at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) 
    at TestWS.localhost.Service1.HelloWorld() in C:\Prototypes\TestWS\Web References\localhost\Reference.cs:line 78 
    at ASP.default_aspx.__Renderform1(HtmlTextWriter __w, Control parameterContainer) in c:\Inetpub\wwwroot\TestWS\Default.aspx:line 17 

使用TCP /跟踪和Wireshark我们可以看到,请求的报头中被发送而不是内容。但是,内容长度HTTP参数是正确的,就好像内容流没有被刷新一样。

我们怀疑Microsoft更新导致了此问题。可能,KB971737KB968389。该问题似乎与IIS 5.x(IIS的XP版本)隔离。

回答

0

UPDATE:事实证明,这是ESET杀毒软件在Web服务器上运行并执行从Web服务器到SOAP服务器的HTTP连接执行实时检查的问题。

完整描述:为了记录这是在HTTP协议处理在.NET中的缺陷。该方案是如下:

客户端发送的HTTP POST的报头:

POST /WS/Test.asmx HTTP/1.1 
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.3603) 
Content-Type: text/xml; charset=utf-8 
SOAPAction: "http://testuri.org/HelloWorld" 
Host: loadtest-app 
Content-Length: 288 
Expect: 100-continue 
Connection: Keep-Alive 

的内容,因为期望的不发送:100继续。服务器现在响应:

HTTP/1.1 100 Continue 

此时客户端不响应。解决这个问题的办法是禁用100-continue,这基本上强制请求头和内容在一个块中发送。这可以在web.config进行搭配:

<system.net> 
    <settings> 
     <servicePointManager expect100Continue="false"/> 
    </settings> 
</system.net> 

但是,如果我们也打开那么协议异常被抛出,说明CR之后应在HTTP头LF客户端跟踪记录。 .Net网络逻辑似乎存在一些脆弱的代码。回顾一下,这只是IIS 5.1中的ASP.NET(在XP上运行的版本)的一个问题。

+0

“WebRequest”中存在一些错误http://regis.decamps.info/blog/2010/12/c-bug-in-webrequest/ – rds 2011-01-03 18:17:35