asp.net-mvc – 如何成功配置Common.Logging?
我试图使用NuGet软件包来配置Common.Logging在ASP.Net MVC项目中使用NLog2.根据以下URL提供的信息,我相信我的记录器配置正确,但我仍然会收到配置错误. Common.Logging Configuration Instructions NLog Configuration Tutorial 我已按照说明将以下内容添加到web.config中: <configuration> <configSections> <section name="nlog" type="NLog.Config.ConfigSectionHandler,NLog"/> <sectionGroup name="common"> <section name="logging" type="Common.Logging.ConfigurationSectionHandler,Common.Logging" /> </sectionGroup> </configSections> <common> <logging> <factoryAdapter type="Common.Logging.NLog.NLogLoggerFactoryAdapter,Common.Logging.NLog20"> <arg key="configType" value="INLINE" /> </factoryAdapter> </logging> </common> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <targets> <target name="logfile" xsi:type="file" filename="e:logfile.txt" layout="${date:format=yyyy/MM/dd HH:mm:ss} ${message}" /> </targets> <rules> <logger name="*" minlevel="Trace" writeTo="logfile" /> </rules> </nlog> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration> 据我所知,这是我应该做的一切,但是当我尝试运行Web项目时,我收到配置错误…
任何人都可以提供有关遗漏或错误的建议? 解决方法问题似乎是Common.Logging NuGet包(v2.0.0)添加的默认配置是不正确的.web.config中的运行时部分需要更改为以下内容: <dependentAssembly> <assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="2.0.0.0" /> </dependentAssembly> 注意oldVersion值.这似乎是导致错误的原因(至少基于我在上述问题中概述的情况). 另请参见这个相关的GitHub问题:Possible Issues with Common.Logging / Common.Logging.NLog20 NuGet packages. (编辑:莱芜站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- asp.net-mvc – 使用Viewbag绑定DropdownlistFor
- 各大输入法分类词库内部格式的简单比较
- Asp.net实现MVC处理文件的上传下载功能实例教程
- asp.net-mvc – 什么是应用程序洞察遥测(未配置)在做什么?
- asp.net-mvc – 使用复杂类型嵌套对象的bind属性include和e
- asp.net-mvc – 为什么在视图引擎中指定位置时,viewstart文
- asp.net – 如何添加.aspx页面到现有的MVC 4项目?
- asp-classic – 如何使用Microsoft.XMLHTTP指定代理配置?
- asp.net中使用repeater和PageDataSource搭配实现分页代码
- Jquery 组合form元素为json格式,asp.net反序列化
- asp.net-mvc – 如何继承ASP.NET MVC控制器并仅更
- Asp.NET控制文件上传的大小方法(超简单)
- asp.net-mvc – 有没有办法重命名RequestVerific
- asp.net-mvc – ASP.NET MVC控制器的[Authorize]
- ASP.NET Core中调整HTTP请求大小的几种方法详解
- asp.net-mvc – 为什么在视图引擎中指定位置时,v
- asp.net – 来自WebHttpBinding的WCF服务中的Acc
- asp.net – 我应该在.gitingore文件中包含.vs文件
- 什么用于ASP.NET的成员资格
- asp.net – VirtualPath位于当前应用程序根目录之