2013-11-04 2 views
0

안녕하세요 저는 추적 및 메시지 WCF에서 로깅에 대한 70-503 시험 MCTS 훈련 키트를 통해 읽고 있어요. 그리고 logEntireMessagefalse으로 설정되어있을 때 추적 파일에 SOAP 메시지의 자세한 헤더가있는 것으로 나타났습니다. 이는 나에게 의미가 없습니다. 그래서 누군가 나에게 이것을 설명 할 수 있을까.logEntireMessage는 SOAP 메시지의 헤더에 영향을 줍니까? MCTS 70-503 훈련 장비는

내 app.config에 내가 필터를 정의한 곳, 다음과 같습니다

<?xml version="1.0"?> 
<configuration> 
    <system.serviceModel> 
    <diagnostics> 
     <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="false" logMessagesAtTransportLevel="true" maxMessagesToLog="3000" maxSizeOfMessageToLog="2000"> 
     <filters> 
      <add xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"> 
      /soap:Envelope/soap:Header/a:Action[starts-with(text(), 'http://schemas.xmlsoap.org')] 
      </add> 
     </filters> 
     </messageLogging> 
    </diagnostics> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="IGetHeaders"> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://localhost:8731/Design_Time_Addresses/DemoService/HeaderService/" binding="wsHttpBinding" bindingConfiguration="IGetHeaders" contract="DemoService.IGetHeaders" name="IGetHeaders"> 
     <headers> 
      <MyHeader xmlns="http://tempuri.org" name="Sample">This is my header data</MyHeader> 
     </headers> 
     <identity> 
      <dns value="localhost"/> 
     </identity> 
     </endpoint> 
    </client> 
    </system.serviceModel> 
    <system.diagnostics> 
    <sources> 
     <source name="System.ServiceModel.MessageLogging" switchName="Information, ActivityTracing"> 
     <listeners> 
      <add name="log" type="System.Diagnostics.XmlWriterTraceListener" initializeData="Traces.svclog"/> 
     </listeners> 
     </source> 
    </sources> 
    <trace autoflush="true"/> 
    </system.diagnostics> 
    <startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> 
    </startup> 
</configuration> 

그리고를 logEntireMessagetrue

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"> 
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"> 
    <EventID>0</EventID> 
    <Type>3</Type> 
    <SubType Name="Information">0</SubType> 
    <Level>8</Level> 
    <TimeCreated SystemTime="2013-11-04T12:26:27.6791265Z" /> 
    <Source Name="System.ServiceModel.MessageLogging" /> 
    <Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" /> 
    <Execution ProcessName="TestClient.vshost" ProcessID="6392" ThreadID="8" /> 
    <Channel/> 
    <Computer>MY-PC</Computer> 
</System> 
<ApplicationData> 
    <TraceData> 
     <DataItem> 
      <MessageLogTraceRecord Time="2013-11-04T13:26:27.6591254+01:00" Source="TransportReceive" Type="System.ServiceModel.Channels.BufferedMessage" xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace"> 
       <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"> 
        <s:Header> 
         <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Issue</a:Action> 
         <a:RelatesTo>urn:uuid:a7c94fd2-fb5a-4ba8-b18f-e9531c9a4cc6</a:RelatesTo> 
        </s:Header> 
        <s:Body> 
         <t:RequestSecurityTokenResponse Context="uuid-656588df-463f-4558-b59d-277cd3b854d6-1" xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
          <t:BinaryExchange ValueType="http://schemas.xmlsoap.org/ws/2005/02/trust/spnego" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">oYG6MIG3oAMKAQGhDAYKKwYBBAGCNwICCqKBoQSBnk5UTE1TU1AAAgAAAA4ADgA4AAAANcKa4ltbUQc7i9awkCraAQAAAABYAFgARgAAAAYBsR0AAAAPQgBBAEgAUgAtAFAAQwACAA4AQgBBAEgAUgAtAFAAQwABAA4AQgBBAEgAUgAtAFAAQwAEAA4AQgBhAGgAcgAtAFAAQwADAA4AQgBhAGgAcgAtAFAAQwAHAAgAHid5FVnZzgEAAAAA</t:BinaryExchange> 
         </t:RequestSecurityTokenResponse> 
        </s:Body> 
       </s:Envelope> 
      </MessageLogTraceRecord> 
     </DataItem> 
    </TraceData> 
</ApplicationData> 

로 설정되어있는 경우 아래의 추적 파일이며,

그리고이 파일은 logEntireMessagefalse으로 설정된 유일한 차이점이 있습니다. 하지만이 파일에서, 나는, SOAP 메시지의 헤더에 대한 더 많은 정보가 보인다 내 사용자 지정 엔드 포인트 헤더 <MyHeader>가 포함되어 예와 <ReplyTo> 태그 등

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"> 
    <System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"> 
     <EventID>0</EventID> 
     <Type>3</Type> 
     <SubType Name="Information">0</SubType> 
     <Level>8</Level> 
     <TimeCreated SystemTime="2013-11-04T12:44:36.0783794Z" /> 
     <Source Name="System.ServiceModel.MessageLogging" /> 
     <Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" /> 
     <Execution ProcessName="TestClient.vshost" ProcessID="8044" ThreadID="9" /> 
     <Channel/> 
     <Computer>MY-PC</Computer> 
    </System> 
    <ApplicationData> 
     <TraceData> 
      <DataItem> 
       <MessageLogTraceRecord Time="2013-11-04T13:44:36.0463775+01:00" Source="TransportSend" Type="System.ServiceModel.Channels.BodyWriterMessage" xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace"> 
        <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"> 
         <s:Header> 
          <a:Action s:mustUnderstand="1" xmlns:a="http://www.w3.org/2005/08/addressing">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</a:Action> 
          <a:MessageID xmlns:a="http://www.w3.org/2005/08/addressing">urn:uuid:a44c286b-1d4b-4446-994c-85f3916f7898</a:MessageID> 
          <a:ReplyTo xmlns:a="http://www.w3.org/2005/08/addressing"> 
           <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address> 
          </a:ReplyTo> 
          <a:To s:mustUnderstand="1" xmlns:a="http://www.w3.org/2005/08/addressing">http://localhost:8731/Design_Time_Addresses/DemoService/HeaderService/</a:To> 
          <MyHeader name="Sample" a:IsReferenceParameter="true" xmlns="http://tempuri.org" xmlns:a="http://www.w3.org/2005/08/addressing">This is my header data</MyHeader> 
         </s:Header> 
        </s:Envelope> 
       </MessageLogTraceRecord> 
      </DataItem> 
     </TraceData> 
    </ApplicationData> 
</E2ETraceEvent> 
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"> 
    <System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"> 
     <EventID>0</EventID> 
     <Type>3</Type> 
     <SubType Name="Information">0</SubType> 
     <Level>8</Level> 
     <TimeCreated SystemTime="2013-11-04T12:44:40.7496466Z" /> 
     <Source Name="System.ServiceModel.MessageLogging" /> 
     <Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" /> 
     <Execution ProcessName="TestClient.vshost" ProcessID="8044" ThreadID="9" /> 
     <Channel/> 
     <Computer>MY-PC</Computer> 
    </System> 
    <ApplicationData> 
     <TraceData> 
      <DataItem> 
       <MessageLogTraceRecord Time="2013-11-04T13:44:40.7396460+01:00" Source="TransportReceive" Type="System.ServiceModel.Channels.BufferedMessage" xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace"> 
        <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"> 
         <s:Header> 
          <a:Action s:mustUnderstand="1" xmlns:a="http://www.w3.org/2005/08/addressing">http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Issue</a:Action> 
          <a:RelatesTo xmlns:a="http://www.w3.org/2005/08/addressing">urn:uuid:a44c286b-1d4b-4446-994c-85f3916f7898</a:RelatesTo> 
         </s:Header> 
        </s:Envelope> 
       </MessageLogTraceRecord> 
      </DataItem> 
     </TraceData> 
    </ApplicationData> 
</E2ETraceEvent> 
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"> 
    <System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"> 
     <EventID>0</EventID> 
     <Type>3</Type> 
     <SubType Name="Information">0</SubType> 
     <Level>8</Level> 
     <TimeCreated SystemTime="2013-11-04T12:44:40.8846543Z" /> 
     <Source Name="System.ServiceModel.MessageLogging" /> 
     <Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" /> 
     <Execution ProcessName="TestClient.vshost" ProcessID="8044" ThreadID="9" /> 
     <Channel/> 
     <Computer>MY-PC</Computer> 
    </System> 
    <ApplicationData> 
     <TraceData> 
      <DataItem> 
       <MessageLogTraceRecord Time="2013-11-04T13:44:40.8836542+01:00" Source="TransportSend" Type="System.ServiceModel.Channels.BodyWriterMessage" xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace"> 
        <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"> 
         <s:Header> 
          <a:Action s:mustUnderstand="1" xmlns:a="http://www.w3.org/2005/08/addressing">http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Issue</a:Action> 
          <a:MessageID xmlns:a="http://www.w3.org/2005/08/addressing">urn:uuid:aec9f076-b9a2-42c2-9e4b-b745e45c3c4c</a:MessageID> 
          <a:ReplyTo xmlns:a="http://www.w3.org/2005/08/addressing"> 
           <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address> 
          </a:ReplyTo> 
          <a:To s:mustUnderstand="1" xmlns:a="http://www.w3.org/2005/08/addressing">http://localhost:8731/Design_Time_Addresses/DemoService/HeaderService/</a:To> 
          <MyHeader name="Sample" a:IsReferenceParameter="true" xmlns="http://tempuri.org" xmlns:a="http://www.w3.org/2005/08/addressing">This is my header data</MyHeader> 
         </s:Header> 
        </s:Envelope> 
       </MessageLogTraceRecord> 
      </DataItem> 
     </TraceData> 
    </ApplicationData> 
</E2ETraceEvent> 
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"> 
    <System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"> 
     <EventID>0</EventID> 
     <Type>3</Type> 
     <SubType Name="Information">0</SubType> 
     <Level>8</Level> 
     <TimeCreated SystemTime="2013-11-04T12:44:40.8906546Z" /> 
     <Source Name="System.ServiceModel.MessageLogging" /> 
     <Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" /> 
     <Execution ProcessName="TestClient.vshost" ProcessID="8044" ThreadID="9" /> 
     <Channel/> 
     <Computer>MY-PC</Computer> 
    </System> 
    <ApplicationData> 
     <TraceData> 
      <DataItem> 
       <MessageLogTraceRecord Time="2013-11-04T13:44:40.8906546+01:00" Source="TransportReceive" Type="System.ServiceModel.Channels.BufferedMessage" xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace"> 
        <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"> 
         <s:Header> 
          <a:Action s:mustUnderstand="1" xmlns:a="http://www.w3.org/2005/08/addressing">http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Issue</a:Action> 
          <a:RelatesTo xmlns:a="http://www.w3.org/2005/08/addressing">urn:uuid:aec9f076-b9a2-42c2-9e4b-b745e45c3c4c</a:RelatesTo> 
         </s:Header> 
        </s:Envelope> 
       </MessageLogTraceRecord> 
      </DataItem> 
     </TraceData> 
    </ApplicationData> 
</E2ETraceEvent> 

MSDN 설명서 것으로 나타났습니다 logEntireMessage에 대한 설명 :

이 값은 전체 메시지 (메시지 머리글과 본문)를 기록할지 여부를 지정합니다. 기본값은 false이며 헤더 만 기록됩니다. 이 설정은 서비스 및 전송 메시지 로깅 수준에 영향을줍니다.

왜 헤더가 다르게 보입니까? 내가 여기서 무엇을 놓치고 있니?

답변

0

이들은 동일한 메시지가 아닙니다. 행동을 자세히 살펴보십시오. 첫 번째는 RST (보안 토큰 요청)입니다. 두 번째는 RSTR (보안 토큰 응답 요청)입니다. 그러므로 그 차이의 이유.

동일한 메시지를 비교할 때 logEntireMessage가 false 인 경우 헤더 만 표시됩니다. SOAP Body는 true로 설정할 때 포함됩니다.

+0

감사! 이제는 의미가 있습니다! – Bahr