asp.netnlognlog-configuration

NLogConfigurationException - Invalid cast from 'System.String' to 'System.Uri'


Nlog is throwing an exception now that I have updated from 1.0 -> 2.0.

When NLog.Config.XmlLoggingConfiguration.Initialize is called the following exception occurs:
"Error when setting property 'Url' on WebService Target[Target_AuditLog_WebService_Global]"
with an innerException of:
"Invalid cast from 'System.String' to 'System.Uri'.

the target looks like this:

<target name="Target_AuditLog_WebService_Global" xsi:type="WebService" namespace="http://ourLoggingServer.corp/" protocol="Soap12" methodName="AddLog" url="http://ourLoggingServer.corp/Logger.asmx">
  <parameter /> <!-- Several params, none of type system.uri -->
</target>

I found this however it seems they think its fixed: http://nlog.codeplex.com/workitem/5352


Solution

  • This is a bug and has been fixed, however, a version with the fix has not yet been released officially or via NuGet, if you run across this issue you will need to use a nightly build version:
    http://nlog.codeplex.com/releases/view/64708 (which I have confirmed works)

    If there has been an official release after 4/27/2011 you should try using it.
    http://nlog.codeplex.com/releases