首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >System.Web.Services.Protocols.SoapHeaderException间歇.Net

System.Web.Services.Protocols.SoapHeaderException间歇.Net
EN

Stack Overflow用户
提问于 2010-02-07 14:59:01
回答 5查看 9.6K关注 0票数 3

我们有一个.net 3.5Web应用程序,它使用第三方web服务。代理是通过向他们的wsdl添加一个web引用来创建的。未编译此代理。

我们的错误日志记录发现了频繁但间歇性的异常:

'System.Web.Services.Protocols.SoapHeaderException‘类型的异常发生并被捕获

如果我按照url到生成异常的页面,就无法重新创建它。

编辑:这是大多数例外--它是从中冒出来的

代码语言:javascript
复制
Message : Internal Error
Type : System.Web.Services.Protocols.SoapHeaderException, System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Source : System.Web.Services Help link : 
Actor : 
Code : http://schemas.xmlsoap.org/soap/envelope/:Client
Detail : 
Lang : 
Node : 
Role : 
SubCode : 
Data : System.Collections.ListDictionaryInternal
TargetSite : System.Object[] ReadResponse(System.Web.Services.Protocols.SoapClientMessage, System.Net.WebResponse, System.IO.Stream, Boolean)
Stack Trace :    at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at Vendor.getSearch(getSearchRequest getSearchRequest) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\be43c34e\b09edc7e\App_WebReferences.pww-cf-q.0.cs:line 73

编辑2:内部异常:

有时,我会记录以下内部异常:

代码语言:javascript
复制
Message : Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
    Type : System.IO.IOException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    Source : System
    Help link : 
    Data : System.Collections.ListDictionaryInternal
    TargetSite : Int32 Read(Byte[], Int32, Int32)
    Stack Trace :    at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
       at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
       at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
       at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
       at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
       at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
       at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
       at System.Net.TlsStream.CallProcessAuthentication(Object state)
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
       at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
       at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
       at System.Net.ConnectStream.WriteHeaders(Boolean async)

和/或:

代码语言:javascript
复制
Message : An existing connection was forcibly closed by the remote host
        Type : System.Net.Sockets.SocketException, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
        Source : System
        Help link : 
        ErrorCode : 10054
        SocketErrorCode : ConnectionReset
        NativeErrorCode : 10054
        Data : System.Collections.ListDictionaryInternal
        TargetSite : Int32 Receive(Byte[], Int32, Int32, System.Net.Sockets.SocketFlags)
        Stack Trace :    at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
           at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)

更新

我们还在努力。最初有一个路线问题得到了解决。我们仍然得到套接字错误的内部异常。我们今天涉及到MS支持,他们查看了一些跟踪和网络捕获。web服务主机执行循环的DNS,并且它们可能响应来自一个ip的syn/ack的不同ip地址,而另一个响应来自不同的IP。这真是不太好。这可能是非常具体的情况,但也许它也适用于其他人。

Microsoft网络监视器和应用程序跟踪为我们提供了所需的信息。

EN

回答 5

Stack Overflow用户

回答已采纳

发布于 2010-02-16 08:21:21

这样做的原因是,当从服务器(响应开始时的SOAP头)读取响应的开始时,服务器没有发送SOAP响应,而是关闭了TCP/IP连接。

显然,错误不在客户端。这很可能是服务器重载的情况,在这种情况下,它不提供响应或500或503 HTTP错误代码,而只是终止TCP/IP连接。有些网络设备导致这些连接下降的可能性很小,但我自然会首先开始研究服务器端。

我建议使用像Fiddler或Wireshark这样的工具来记录这些错误之一。由于这是一个强制的TCP/IP连接关闭,所以我将查找与以TCP RST数据包结束的服务器之间的通信,该数据包强制关闭连接。

票数 2
EN

Stack Overflow用户

发布于 2010-02-07 21:05:04

此异常是通过SOAP头从服务器端产生的,您的客户机在这里可能没有错。您可能会从第三方web服务提供商那里获得更多有关此错误的信息。

票数 1
EN

Stack Overflow用户

发布于 2010-02-16 04:13:58

我们最近在我们自己的web服务中遇到了这个问题,它最终成为了一个超时问题。web服务的实际超时时间设置得足够高,永远不会被击中,但是它抛出了这个异常,因为它没有提供任何更新来保持生命(非抽水)。这是我们的解决办法,希望能有所帮助。您可以对您的web服务进行子类化,或者将其直接放入reference.cs文件中,但是当您更新web引用时,它会被覆盖。

代码语言:javascript
复制
public partial class TheWebServiceSubClass : TheWebService
{
    protected override WebRequest GetWebRequest(Uri uri)
    {
        HttpWebRequest webRequest = (HttpWebRequest) base.GetWebRequest(uri);

        webRequest.KeepAlive = false;
        webRequest.ProtocolVersion=HttpVersion.Version10;
        return webRequest;
    }
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2217136

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档