开发者

What WCF logging should I enable to help track down why a channel is being faulted?

The WCF channel is somehow getting into the faulted state in the client, what WCF logging show I enable to help track开发者_运维技巧 down the reason?

How do I enable the given logging from code? (The channel etc is setup in code rather than a config file on each side)


Edit: Both sides are Winforms applications, so I don’t have a web.config file, but I do have a app.config file.


You don't need to add the logging in code. On both the service (web.config) and the client (app.config) add this:

<system.diagnostics>
<sources>
  <source name="System.ServiceModel" switchValue="Verbose, ActivityTracing">
    <listeners>
      <add name="xml"/>
    </listeners>
  </source>
  <source name="System.ServiceModel.MessageLogging" switchValue="Verbose">
    <listeners>
      <add name="xml"/>
    </listeners>
  </source>
</sources>
<sharedListeners>
  <add name="xml" type="System.Diagnostics.XmlWriterTraceListener" 
     initializeData="c:\logs\logfilename.svclog"/>
</sharedListeners>
<trace autoflush="true"/>
</system.diagnostics>

You should use the Service Trace Viewer (SvcTraceViewer.exe, included in SDK v6.0a) to view the files.


you can still enable logging from web.config using system.diagnostics element (even if your channel was setup in code).

here are some msdn links: (1) (2)

You can also have a look > here < for step by step walkthrough.


A bit of a shot in the dark, but this may be more of a debugging issue than a logging one.

You may need to check that your connections are being closed or pooled correctly. I use netstat from the command line to keep track of the open connections to the service to verify that connections are closed when I think they should be.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜