登录WCF服务调用与参数信息参数、信息、WCF

2023-09-04 02:07:01 作者:  ご錵╬訫ご | こ哆☆訫こ

我一直在使用服务跟踪查看器来分析在我们的应用程序发出的WCF服务电话,但我真的需要看到传递给服务方法的参数值?这可能吗?我试着打开记录到最大输出,但仍然看不到任何东西:(

I've been using the Service Trace Viewer to analyse the WCF service calls that are made in our application but I really need to see the parameter values that are passed to the service methods? Is this possible? I've tried turning the logging to max output but still can't see anything :(

推荐答案

如果您启用邮件跟踪,你应该得到这两个调用的所有详细信息(包括您的邮件送出的XML重新presentation)以及作为回答:

If you enable message tracing, you should get all the details of both the call (including the XML representation of your message sent out) as well as the answer:

<system.diagnostics >
  <sources>
    <source  
        name="System.ServiceModel.MessageLogging" 
        switchValue="Information, ActivityTracing" >
       <listeners>
          <add name="yourTrace" 
               type="System.Diagnostics.XmlWriterTraceListener" 
               initializeData="C:\Logs\YourMessageLog.svclog">
             <filter type="" />
           </add>
       </listeners>
     </source>
  </sources>
  <trace autoflush="true" />
</system.diagnostics>
<system.serviceModel>
   <diagnostics>
       <messageLogging 
             logMessagesAtTransportLevel="true" 
             logMessagesAtServiceLevel="false"
             logMalformedMessages="true" 
             logEntireMessage="true"
             maxSizeOfMessageToLog="65535000" maxMessagesToLog="500" />
    </diagnostics>
</system.serviceModel>

这应该在一个目录下创建一个名为YourMessageLog.svclog的文件。C:\日志(!必须事先存在),并且可以查看与WCF服务跟踪查看器

This should create a file called "YourMessageLog.svclog" in a directory "C:\Logs" (which must exist beforehand!) and which you can view with the WCF Service Trace Viewer.

您可以在这里看到的是 XML重新$ P $消息出去,响应回来的psentation - 您的参数将被包装成你的XML结构在这里。这就是你要找的是什么?

What you'll see here is the XML representation of the message going out and the response coming back in - your parameters will have been wrapped into your XML structure here. Is that what you're looking for?