3

Microsoft Service Trace Viewerを使用して、ログの例外を確認しています。例外は次のとおりです。

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サービスのメソッドを使用して複数のレポートを生成していますが、1つを除いてすべて問題ありません。(このレポートには多くのデータがあります)。返されるデータ/タイムアウトが多すぎることに関係していると思いますが、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>

助けてください、私は本当にここに手がかりがありません...

4

2 に答える 2

2

より具体的なエラーを取得するには、クライアントとサービスの両方でトレースを有効にします。詳細については、以下のリンクを参照してください。.svclog ファイルを取得したら、トレース ビューアーで開き、赤で強調表示されているアクティビティをクリックして詳細を表示します。MaxReceivedMessageSize などの WCF 制限を超えている場合は、クライアントまたはサービスのいずれかのログに表示されます。

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

WCF トレースを有効にする方法は?

于 2012-11-14T15:21:42.057 に答える
0

私が遭遇した一般的な原因は、DataContractSerializer 例外です。通常、それは私にとって循環参照です。

通常、私が行うことは、DataContractSerializer を使用して返されるオブジェクトを手動でシリアル化するサービスのどこかにコメント付きのコード ブロックを残すことです。生成された例外から、より有用なメッセージが得られます。

「値」変数があると仮定すると、タスクを達成する 1 つの方法を次に示します。

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

次に、コードを実行して例外を調べます。

于 2013-05-15T20:37:19.300 に答える