2012-11-14 77 views
3

我正在使用Microsoft服务跟踪查看器检查日志以查找异常。例外是:需要帮助了解Microsoft服务跟踪查看器日志

An error occurred while receiving the HTTP response to ...someservice.svc. 
This could be due to the service endpoint binding not using the HTTP protocol. 
This could also be due to an HTTP request context being aborted by the server 
(possibly due to the service shutting down). See server logs for more details. 

该web服务已启动并运行,我可以达到它的罚款。我使用来自同一web服务的方法生成了几个报告,除了一个以外,一切都很好。 (这份报告有很多数据)。我猜它与返回太多的数据/超时有关,但我如何使用Microsoft Service Trace Viewer来检查这个问题? (我是这个工具的新手)。

这是我的异常字符串:

<ExceptionString>System.ServiceModel.CommunicationException: An error occurred 
while receiving the HTTP response to http://someservice.svc. This could be due 
to the service endpoint binding not using the HTTP protocol. This could also 
be due to an HTTP request context being aborted by the server (possibly due to 
the service shutting down). See server logs for more details. ---> 

System.Net.WebException: The underlying connection was closed: An unexpected 
error occurred on a receive. ---> 

System.IO.IOException: Unable to read data from the transport connection: An 
existing connection was forcibly closed by the remote host. ---> 

System.Net.Sockets.SocketException: An existing connection was forcibly 
closed by the remote host 
    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) 
    --- End of inner exception stack trace --- 
    at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) 
    at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) 
    at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead) 
    --- End of inner exception stack trace --- 
    at System.Net.HttpWebRequest.GetResponse() 
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) 
    --- End of inner exception stack trace ---</ExceptionString> 

请帮帮忙,我真的来到这里不知道......

回答

2

,试图获得一个更具体的错误,启用跟踪同时在客户端和服务,请参阅下面的链接了解更多信息。一旦你有一个.svclog文件,用跟踪查看器打开它,点击红色突出显示的任何活动以查看详细信息 - 如果超出了WCF限制(如MaxReceivedMessageSize),它应该出现在客户端或服务的日志中。

http://msdn.microsoft.com/en-us/library/ms733025.aspx

How to turn on WCF tracing?

+0

感谢您的回答。 我刚刚拿到了很多更多数据的som dbtables,并设法重现崩溃。这似乎与MaxReceivedMessageSize有关,但是从日志中我不确定如何验证这一点。我已经使用配置扩展了日志记录。从我的app.config中“如何打开wcf跟踪”,但我仍然看不到日志中的任何消息,说我已经超过了MaxReceivedMessageSize。我是否还需要将日志记录添加到web.config文件中? – user1823747

+0

是的,添加跟踪web.config,因为它可能是服务器端的错误。 –

0

这样做的一个常见原因,从以前遇到过什么,我是一个DataContractSerializer的例外。通常这是我的循环参考。

通常我会做的是在服务某处使用DataContractSerializer手动序列化即将返回的对象的代码块。您将从它生成的异常中获得更有用的消息。

假设你有一个“值”变量,这里是完成任务的一种方法:

var xs = new DataContractSerializer(value.GetType()); 
var ms = new MemoryStream(); 
xs.WriteObject(ms, value); 

然后,我将执行代码以检查异常。