NLog throws configuration exception on all aspnet layout renderers

后端 未结 4 1371
盖世英雄少女心
盖世英雄少女心 2021-02-05 05:02

I have been working to set up NLog v2 on my ASP.NET MVC 3 application and it has worked very well so far. (I\'m using the package from the offical nuGet repository) However, w

4条回答
  •  感情败类
    2021-02-05 06:07

    Alternative solution if Darin's doesn't work

    You must have NLog.Extended referenced as Darin mentions http://nuget.org/packages/NLog.Extended

    As of NLog 2.0 you do not need to add reference in the configuration XML.

    My problem was that I had no hard references to NLog.Extended in my web layer (where my web.config is) so the compiler wasn't copying the file where it needed to be.

    This can be easily fixed by adding a hard reference to NLog.Extended that is a no-op wherever you are configuring your logging:

    //forces the compiler to include NLog.Extensions in all downstream output directories
    private static AspNetApplicationValueLayoutRenderer blank = new AspNetApplicationValueLayoutRenderer();
    

提交回复
热议问题