NLog Webservice Target - Soap envelope missing #1851

blakatos opened this Issue Dec 14, 2016 · 7 comments


None yet

2 participants

blakatos commented Dec 14, 2016 edited
  • Bug

NLog version: (e.g. 4.2.3)

Platform: ..Net 4.5.2

Current NLog config (xml or C#, if relevant)

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns=""
      xsi:schemaLocation=" NLog.xsd"
      internalLogFile="c:\nLogDebugging.txt" internalLogLevel="Trace">

    <target xsi:type="WebService"
         <parameter layout="" name="from" type="System.String"/>
          <parameter layout="" name="to" type="System.String"/>
          <parameter layout="" name="cc" type="System.String"/>
    <logger name="*" minlevel="Debug" writeTo="EmailWebService" />

In case of a BUG:

  • What is the current result?
    When I call the webservice by adding a service reference is Visual Studio 2015 I see this in Fiddler:
POST http://computername/TestWSForNLog2/MyWebService.asmx HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.42000)
VsDebuggerCausalityData: uIDPo4rtZBSuD1RGtQzXHA48wAcAAAAAIyg/V4GZak2tTxbfdqq1CxRIDzCgKRhOpp04ElhwUo0ACQAA
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://namespace/webservices/SendMail2"
Host: computername
Content-Length: 327
Expect: 100-continue

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="" xmlns:xsi="" xmlns:xsd=""><soap:Body><SendMail2 xmlns="http://namespace/webservices"><from /><to>><cc /></SendMail2></soap:Body></soap:Envelope>

However, when I call the logger and use the above target, Fiddler catches this session from NLog. Which is missing the Soap Envelope:

POST http://computername/TestWSForNLog2/MyWebService.asmx HTTP/1.1
SOAPAction: http://namespace/webservices/SendMail2
Content-Type: text/xml; charset=utf-8
Host: computername
Content-Length: 254
Expect: 100-continue

Here is the code which generates the NLog call:

logger.Log(LogLevel.Error, "This is my message");

logger is defined at the top of the class:

private static Logger logger = LogManager.GetCurrentClassLogger();

The computername above refers to another PC on our network where I have the webservice hosted for development. When I break point the webservice on computername, the break point is hit when called from the service reference, but not when called through NLog.

Any help is appreciated. I am stuck, having tried everything I can think of and google.

304NotModified commented Dec 14, 2016 edited

are we missing the whole body?

**Note: In the envelope above I had delete the "<"'s. If I didn't the text wasn't being displayed properly.

Could you post it in the code blocks? See - I have partially fixed it already.

Could you also test with NLog 4.4? (just released) - thx!


Thank you 304NotModified. I have corrected the rest of the formatting.

As far as I can tell from using Fiddler, the whole body is missing. I have posted in the original post everything from the Raw tab in Fiddler.


I upgraded to version 4.4, but unfortunately the results are the same.


Thanks for testing.

There are unit tests which using the web service target (and sent them to local), which are succeeding. I'm pretty sure the web service target does work.

I will check why fiddler won't show the body


Hello 304NotModified,
Were you able to determine if there is anything wrong with what I am doing?


Unfortunately no, but I'm pretty sure the webservice target does work (as the unit test is also starting up a Owin service)

@304NotModified 304NotModified self-assigned this Dec 21, 2016
304NotModified commented Jan 14, 2017 edited

sorry this issue is low on my list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment