Asp.net

NLogConfigurationException - 從“System.String”到“System.Uri”的無效轉換

  • April 28, 2011

既然我已經從 1.0 -> 2.0 更新,Nlog 正在拋出異常。

當呼叫 NLog.Config.XmlLoggingConfiguration.Initialize 時,會發生以下異常:

“在 WebService Target 上設置屬性 ‘Url’ 時出錯$$ Target_AuditLog_WebService_Global $$”

帶有一個 innerException :
“從 ‘System.String’ 到 ‘System.Uri’ 的無效轉換。

目標看起來像這樣:

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

我發現了這一點,但他們似乎認為它是固定的:http: //nlog.codeplex.com/workitem/5352

這是一個錯誤並已修復,但是帶有修復的版本尚未正式發布或通過 NuGet 發布,如果您遇到此問題,您將需要使用夜間建構版本:
http://nlog.codeplex。 com/releases/view/64708(我已經確認有效)

如果在 2011 年 4 月 27 日之後有正式版本,您應該嘗試使用它。

http://nlog.codeplex.com/releases

引用自:https://stackoverflow.com/questions/5757022