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 MVC4中是否可以将C#或VB函数标记为Javascript?
- WPF 一个数据库连接测试的实现
- asp.net-mvc – 尝试创建类型为’TypeNewsController’的控
- asp.net使用多线程更新UI
- asp.net-mvc – Visual Studio 2010 Full和ASP.NET MVC 2.0
- asp.net-mvc – 如何在ASP.NET MVC4中使用具有唯一标识符UR
- ASP.net Substitution 页面缓存而部分不缓存的实现方法
- asp.net – 有没有一个原因,cshtml不受欢迎
- asp.net-core – 找不到Swashbuckle.AspNetCore SwaggerOpe
- asp.net – 我可以在超链接上显式指定NavigateUrl吗?
- asp.net-mvc – 删除布局将默认为_ViewStart,为什
- 实体框架 – 实体框架核心更新许多对许多
- asp.net-mvc – 如何组合两个dataTextFields的Se
- AJAX分页的代码(后台asp.net)
- asp.net – @ Url.Action在控制器中创建空值的参
- asp.net-mvc – ASP.NET MVC 4 Visual Studio 20
- asp.net-core – 在Visual Studio CTP2中的ASP.V
- 记一道毫无思路的算法题
- asp.net-core – ASP.Net 5类库中的EntityFramew
- asp.net web.config加密解密方法