简体   繁体   English

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

[英]NLog not generating SOAP when using WebService target in VS 2012, Windows 8

I can't seem to get NLog to work properly on my console application . 我似乎无法让NLog在我的控制台应用程序上正常工作。 I'm running VS 2012 on a Windows 8 machine. 我在Windows 8计算机上运行VS 2012。 I've targeted the project to use 4.0 Framework. 我已将项目定位为使用4.0 Framework。

Using fiddler, I can see that it is trying to send a message to the target, but it only has header information in the request. 使用小提琴手,我可以看到它正在尝试向目标发送消息,但是在请求中仅包含标头信息。 There is no SOAP envelope. 没有SOAP信封。 It should generate the SOAP message based on my parameters but does not. 它应该根据我的参数生成SOAP消息,但不会。

I've also tried this programatically, but that doesn't work either. 我也以编程方式尝试过此操作,但这也不起作用。

Here is my config: 这是我的配置:

    <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>

Any ideas? 有任何想法吗?

I was able to get it working by going all the way back to version NLog 1.0 Refresh. 我可以一直回到NLog 1.0 Refresh版本来使其工作。 I'm still in the 4.0 framework but it works. 我仍然在4.0框架中,但是它可以工作。 Still doesn't explain how to get it going in the latest version. 仍然没有说明如何在最新版本中运行它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM