0
我一直試圖在Asp.Net Web Api 2.2應用程序中將NLog作爲一個跟蹤編寫器來實現。這是我的web.config:NLog不寫在Asp.Net Web Api App中
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
</configSections>
<nlog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.nlog-project.org/schemas/NLog.xsd" throwExceptions="true" internalLogFile="c:\file.txt">
<targets>
<target name="logfile" xsi:type="File" fileName="${basedir}/Logs/log.txt"/>
<rules>
<logger name="*" minlevel="Info" writeTo="logfile"/>
</rules>
</targets>
在調試過程中這一點,如果我使用IIS Express作爲主機工作正常,但如果我設置的項目中使用本地IIS失敗了System.UnauthorizedAccessException
。我也以管理員身份運行VS 2013。