在VS 2012, Windows 8中使用WebService目标时,NLog不生成SOAP

本文关键字:NLog 目标 SOAP WebService 2012 VS Windows | 更新日期: 2023-09-27 18:06:25

我似乎不能让NLog在我的控制台应用程序上正常工作。我在Windows 8机器上运行VS 2012。我的目标项目使用4.0框架。

使用fiddler,我可以看到它正在尝试向目标发送消息,但它在请求中只有头部信息。没有SOAP信封。它应该根据我的参数生成SOAP消息,但是没有。

我也尝试过这个编程,但这也不起作用。

下面是我的配置:

    <configSections>
    <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
  </configSections>
  <nlog internalLogLevel="Trace" throwExceptions="true" autoReload="true" internalLogFile="C:'TestDocs'Fail.txt" xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <targets>
      <target name="ws" xsi:type="WebService" protocol="Soap11" namespace="http://tempuri.org/" url="http://xxxxxx.com/Services/LogService.asmx" methodName="WriteLog">
                  <parameter name="appDate" layout="${date}" type="System.String"/>
          <parameter name="msg" layout="${message}" type="System.String"/>        
      </target>
    </targets>
    <rules>
      <logger name="*" writeTo="ws" />
    </rules>
  </nlog>

任何想法?

在VS 2012, Windows 8中使用WebService目标时,NLog不生成SOAP

我能够通过回到NLog 1.0刷新版本让它工作。我仍然在4.0框架,但它的工作原理。仍然没有解释如何在最新版本中使其运行