IT story

WCF 추적을 설정하는 방법은 무엇입니까?

hot-time 2020. 6. 10. 08:04
반응형

WCF 추적을 설정하는 방법은 무엇입니까?


최신 정보:

WCF 추적 을 설정하려고 했지만 여전히 성공하지 못했습니다 ... 아래는 마지막 업데이트입니다.

아래 위치에 쓸 수있는 권한이 필요합니까?

  <system.diagnostics>
    <trace autoflush="true" />
    <sources>
      <source name="System.ServiceModel"
              switchValue="Information, ActivityTracing"
              propagateActivity="true">
        <listeners>
          <add name="sdt"
              type="System.Diagnostics.XmlWriterTraceListener"
              initializeData= "@\\myservername\folder1\traces.svclog" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>

.NET Framework 3.5를 사용하고 있습니다.

디버깅 목적으로 WCF 추적을 설정하는 단계별 지침은 무엇입니까?


WCF 서비스 에서 추적을 사용하기 위해 MSDN 에서 가져온 다음 구성을 적용 할 수 있습니다 .

<configuration>
  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel"
              switchValue="Information, ActivityTracing"
              propagateActivity="true" >
        <listeners>
             <add name="xml"/>
        </listeners>
      </source>
      <source name="System.ServiceModel.MessageLogging">
        <listeners>
            <add name="xml"/>
        </listeners>
      </source>
      <source name="myUserTraceSource"
              switchValue="Information, ActivityTracing">
        <listeners>
            <add name="xml"/>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
        <add name="xml"
             type="System.Diagnostics.XmlWriterTraceListener"
             initializeData="Error.svclog" />
    </sharedListeners>
  </system.diagnostics>
</configuration>

로그 파일을 보려면 "C : \ Program Files \ Microsoft SDKs \ Windows \ v7.0A \ bin \ SvcTraceViewer.exe"를 사용하십시오.

"SvcTraceViewer.exe"가 시스템에 없으면 "Windows 7 및 .NET Framework 4 용 Microsoft Windows SDK"패키지에서 다운로드 할 수 있습니다.

Windows SDK 다운로드

You don't have to install the entire thing, just the ".NET Development / Tools" part.

When/if it bombs out during installation with a non-sensical error, Petopas' answer to Windows 7 SDK Installation Failure solved my issue.


In your web.config (on the server) add

<system.diagnostics>
 <sources>
  <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
   <listeners>
    <add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="C:\logs\Traces.svclog"/>
   </listeners>
  </source>
 </sources>
</system.diagnostics>

Go to your Microsoft SDKs directory. A path like this:

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools

Open the WCF Configuration Editor (Microsoft Service Configuration Editor) from that directory:

SvcConfigEditor.exe

(another option to open this tool is by navigating in Visual Studio 2017 to "Tools" > "WCF Service Configuration Editor")

wcf configuration editor

Open your .config file or create a new one using the editor and navigate to Diagnostics.

There you can click the "Enable MessageLogging".

enable messagelogging

More info: https://msdn.microsoft.com/en-us/library/ms732009(v=vs.110).aspx

With the trace viewer from the same directory you can open the trace log files:

SvcTraceViewer.exe

You can also enable tracing using WMI. More info: https://msdn.microsoft.com/en-us/library/ms730064(v=vs.110).aspx


Instead of you manual adding the tracing enabling bit into web.config you can also try using the WCF configuration editor which comes with VS SDK to enable tracing

https://stackoverflow.com/a/16715631/2218571

참고URL : https://stackoverflow.com/questions/4271517/how-to-turn-on-wcf-tracing

반응형