asp.net-mvc – NLog在所有aspnet布局渲染器上抛出配置异常
发布时间:2020-05-23 14:22:53 所属栏目:asp.Net 来源:互联网
导读:我一直在努力在我的ASP.NET MVC 3应用程序上设置NLog v2,迄今为止已经运行得很好。 (我正在使用官方nuGet存储库中的包)但是,当我尝试更改日志布局以包含任何aspnet- *布局渲染器时,我得到一个配置错误。我将问题减少到以下最低用例: 在configSections块中
|
我一直在努力在我的ASP.NET MVC 3应用程序上设置NLog v2,迄今为止已经运行得很好。 (我正在使用官方nuGet存储库中的包)但是,当我尝试更改日志布局以包含任何aspnet- *布局渲染器时,我得到一个配置错误。我将问题减少到以下最低用例: 在configSections块中: <section name="nlog" type="NLog.Config.ConfigSectionHandler,NLog"/> Nlog块: <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throwExceptions="true">
<variable name="logDirectory" value="C:Logs" />
<targets>
<target name="logFile" xsi:type="File" fileName="${logDirectory}app.log"
layout="${aspnet-user-identity}" />
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="logfile" />
</rules>
如果我改变布局,使用不属于aspnet *系列的任何渲染器的组合,这样做很好(我没有测试过,但是我已经看了很多)。我得到的错误在这里: Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: An error occurred creating the configuration section handler for nlog: Exception occurred when loading configuration from C:..[snip]..web.config Source Error: Line 16: </configSections> Line 17: Line 18: <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" Line 19: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throwExceptions="true"> Line 20: 我真的不知道发生了什么。我不知道该渲染器会导致配置无效。我一直在大声喧哗,没有任何地方,所以我希望有人能帮忙。 谢谢! 解决方法请确保您引用了NLog.Extended程序集,这些程序集定义了哪些布局,哪些必须由NuGet软件包添加到引用中:<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
throwExceptions="true">
<extensions>
<add assembly="NLog.Extended" />
</extensions>
<variable name="logDirectory" value="C:Logs" />
<targets>
<target name="logFile"
xsi:type="File"
fileName="${logDirectory}app.log"
layout="${aspnet-user-identity} ${message}" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="logfile" />
</rules>
</nlog> (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 如果用户在int字段中放入非数字字符串,则自
- asp.net-mvc – 如何在Asp.net MVC 2中替换默认的ModelStat
- .net-4.0 – 为什么有潜在危险的请求错误甚至ValidateReque
- asp.net – 可能导致XML解析错误:没有找到元素?
- asp.net – UserControl Viewstate在回发后丢失所有值
- asp.net-mvc – Internet Explorer缓存asp.netmvc ajax结果
- 两个单选按钮ASP.NET C#
- asp.net-mvc – 访问ASP.NET MVC应用程序中的控制器/操作列
- asp.net-mvc-3 – ASP.NET MVC重定向到没有物理重定向的操作
- asp.net – 如何在MVC4的部分视图中添加脚本?
推荐文章
站长推荐
- ASP.Net Forms身份验证在10分钟后注销用户
- asp.net-mvc – 具有点的窗体元素的MVC Controll
- .net – 将HtmlTextWriter的内容转换为字符串
- 如何调试asp.net mvc 4源代码?
- IIS7集成vs经典流水线 – 哪些使用更多的ASP.NET
- asp.net-mvc – 添加ELMAH并更改elmah.mvc.route
- asp.net-mvc – MVC 4忽略DefaultModelBinder.Re
- .net – 什么是Automapper?
- asp.net – 从1.7到1.9的迷你探查器升级破坏了现
- asp.net-mvc – 使用城堡温莎的实体框架
热点阅读
