2009-05-15 18 views
1

私は学習WCF帳からサンプルをしようとしてHTTPリクエスト/レスポンスを検査しようとしています。私はMS TraceViewerでHTTPリクエストヘッダを見ることができますが、不思議なことにレスポンスヘッダはありません。 (封筒のみ)。あなたが何か気づいていない場合は、私に知らせてもらえますか?WCF:HttpResponseがここにログに記録されないのはなぜですか?

<configuration> 
    <system.serviceModel> 
    <diagnostics> 
     <messageLogging logEntireMessage="true" logMalformedMessages="true" 
     logMessagesAtServiceLevel="true"/> 
    </diagnostics> 

<!--other stuff--> 

    <system.diagnostics> 
     <sources> 
      <source name="System.ServiceModel" switchValue="Off, ActivityTracing"> 
      <listeners> 
       <add type="System.Diagnostics.DefaultTraceListener" name="Default"> 
       <filter type="" /> 
       </add> 
       <add initializeData="x.log" type="System.Diagnostics.XmlWriterTraceListener" 
       name="sdt"> 
       <filter type="" /> 
       </add> 
      </listeners> 
      </source> 
      <source name="System.ServiceModel.MessageLogging" switchValue="Verbose,ActivityTracing"> 
      <listeners> 
       <add type="System.Diagnostics.DefaultTraceListener" name="Default"> 
       <filter type="" /> 
       </add> 
       <add name="ServiceModelMessageLoggingListener"> 
       <filter type="" /> 
       </add> 
      </listeners> 
      </source> 
     </sources> 
     <sharedListeners> 
      <add initializeData="D:\temp\messages.xml" type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
      name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp"> 
      <filter type="" /> 
      </add> 
     </sharedListeners> 
     <trace autoflush="true" /> 
     </system.diagnostics> 
</configuration> 

リクエスト適切に記録されます:

<MessageLogTraceRecord> 
<HttpRequest xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace"> 
<Method>POST</Method> 
<QueryString></QueryString> 
<WebHeaders> 
<SOAPAction>"http://www.thatindigogirl.com/samples/2006/06/GigManagerServiceContract/SaveGig"</SOAPAction> 
<Connection>Keep-Alive</Connection> 
<Content-Length>485</Content-Length> 
<Content-Type>text/xml; charset=utf-8</Content-Type> 
<Expect>100-continue</Expect> 
<Host>localhost:8000</Host> 
</WebHeaders> 
</HttpRequest> 
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
<s:Header> 
<To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://localhost:8000/GigManagerService</To> 
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://www.thatindigogirl.com/samples/2006/06/GigManagerServiceContract/SaveGig</Action> 
</s:Header> 
<s:Body> 
<SaveGig xmlns="http://www.thatindigogirl.com/samples/2006/06"> 
<item xmlns:a="wcf_expts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> 
<a:DateEnd>2009-11-01T05:30:00</a:DateEnd> 
<a:DateStart>2009-10-31T22:30:00</a:DateStart> 
<a:Description>some desc</a:Description> 
<a:Id>0</a:Id> 
<a:Place i:nil="true"></a:Place> 
<a:Title>some boring event</a:Title> 
<a:Url>http://askfdj.com</a:Url> 
</item> 
</SaveGig> 
</s:Body> 
</s:Envelope> 
</MessageLogTraceRecord> 
トレースビューアで

と私は見レスポンス(?理由なしヘッダ、HTTPレスポンス)

<MessageLogTraceRecord> 
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
<s:Header> 
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://www.thatindigogirl.com/samples/2006/06/GigManagerServiceContract/SaveGigResponse</Action> 
</s:Header> 
<s:Body> 
<SaveGigResponse xmlns="http://www.thatindigogirl.com/samples/2006/06"></SaveGigResponse> 
</s:Body> 
</s:Envelope> 
</MessageLogTraceRecord> 

答えて

2

あなたは上のストリーミングをやっています応答側?それはそれを説明するでしょう - あなたがストリーミングを使用すると、(ストリーミングされたデータではなく)ヘッダーだけが記録されます。

マルク・

+0

ました有用なリード。私はストリーミングモードについて知らなかった。しかし、デフォルトのモードをバッファリングされ、以下のリンクで提案されているように、私は明示的にバッファに設定していても、私のログに違いを確認していないようだと思われます。 http://msdn.microsoft.com/en-us/library/system.servicemodel.basichttpbinding.aspx – ottodidakt

1

メッセージがストリーミングされた場合は、あなたが見るであろうが、「...ストリーム...」トレースのbodyタグ内(私はpost on thatを書いた。

アーレはそこ以外のヘッダHttpRequestのへの応答のためのSOAPヘッダー?私はあなたが探しているように見えるものを意味し、私はよく分からないので、私は非常に間違っている可能性がありますHttpRequestのヘッダですが、応答はHttpRequestのではありません。:)

関連する問題