如何获取XML格式的WCF请求?

时间:2019-01-16 11:21:38

标签: wcf

我已经创建了WCF服务,并且得到了适当的输出, 但我想知道我要发送什么请求?

service1 oc = new service1();
oc.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None; 
oc.ClientCredentials.UserName.UserName = UserName;
oc.ClientCredentials.UserName.Password = Password; 
RM[] ass = oc.GetReasonMasterlist();

1 个答案:

答案 0 :(得分:1)

如果您想做自己的事情,则可以编写自定义拦截器,或者按照https://docs.microsoft.com/en-us/dotnet/framework/wcf/diagnostics/configuring-message-logging

启用跟踪日志记录
<system.diagnostics>  
  <sources>  
    <source name="System.ServiceModel.MessageLogging">  
      <listeners>  
         <add name="messages"  
              type="System.Diagnostics.XmlWriterTraceListener"  
              initializeData="c:\logs\messages.svclog" />  
        </listeners>  
    </source>  
  </sources>  
</system.diagnostics>  

<system.serviceModel>  
  <diagnostics>  
    <messageLogging   
         logEntireMessage="true"   
         logMalformedMessages="false"  
         logMessagesAtServiceLevel="true"   
         logMessagesAtTransportLevel="false"  
         maxMessagesToLog="3000"  
         maxSizeOfMessageToLog="2000"/>  
  </diagnostics>  
</system.serviceModel>