简体   繁体   English

C# Web 服务客户端线程被中止

[英]C# Web service client Thread was being aborted

in this opportunity i'm facing a very weird problem when try to call a web service method multiples times.在这个机会中,当我尝试多次调用 web 服务方法时,我遇到了一个非常奇怪的问题。 for some reason after several invokes i get the following exception.出于某种原因,在几次调用后,我得到了以下异常。 Thread was being aborted and this is the trace of that exception:线程被中止,这是该异常的痕迹:

at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
at System.Net.Connection.PollAndRead(HttpWebRequest request, Boolean userRetrievedStream)
at System.Net.ConnectStream.PollAndRead(Boolean userRetrievedStream)
at System.Net.HttpWebRequest.EndWriteHeaders(Boolean async)
at System.Net.HttpWebRequest.WriteHeadersCallback(WebExceptionStatus errorStatus, ConnectStream stream, Boolean async)
at System.Net.ConnectStream.WriteHeaders(Boolean async)
at System.Net.HttpWebRequest.EndSubmitRequest()
at System.Net.HttpWebRequest.CheckDeferredCallDone(ConnectStream stream)
at System.Net.HttpWebRequest.GetResponse()
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)

This is happening in my production environment, and when i try to reproduce the bug in my developer o test environment it works properly, so i really dont know what it exactly the problem that is occurring with this invocation.这发生在我的生产环境中,当我尝试在我的开发人员或测试环境中重现错误时,它可以正常工作,所以我真的不知道这个调用到底是什么问题。

can you guy give me an advice in order to solve this issue.你能给我一个建议来解决这个问题吗?

thanks in advance.提前致谢。

I would enable WCF trace logging on the server, and check the service log after the error occurs.我将在服务器上启用 WCF 跟踪日志记录,并在发生错误后检查服务日志。 See here: http://msdn.microsoft.com/en-us/library/aa702726.aspx请参阅此处: http://msdn.microsoft.com/en-us/library/aa702726.aspx

If/When errors occur in the WCF stack, outside your application code, like serialization and endpoint errors, then end up in the service log.如果/当 WCF 堆栈中发生错误时,在您的应用程序代码之外,如序列化和端点错误,则最终出现在服务日志中。


Edit:编辑:

Also, I think the error and stack trace you provided are from the client's perspective.另外,我认为您提供的错误和堆栈跟踪是从客户的角度来看的。 There was likely an exception on the server that caused the server to not properly reply to the client, hence the client's error.服务器上可能存在异常,导致服务器无法正确回复客户端,因此客户端出错。 The server is where you should be looking for the root cause of this issue.服务器是您应该寻找此问题的根本原因的地方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM