Wierd error trying to instantiate nlogger with servicestack

Any ideas on what the heck this is about?

Cannot access the constructor of type: ServiceStack.Logging.NLogger.NLogLogger. Is the required permission granted?

happens as the servicehost is instantiated.

[NLogConfigurationException: Cannot access the constructor of type: ServiceStack.Logging.NLogger.NLogLogger. Is the required permission granted?]
NLog.Internal.FactoryHelper.CreateInstance(Type t) +239
NLog.LogFactory.GetLogger(LoggerCacheKey cacheKey) +1000
ServiceStack.Logging.NLogger.NLogLogger…ctor(Type type) +140
ServiceStack.Logging.NLogger.NLogFactory.GetLogger(Type type) +38
ServiceStack.ServiceStackHost…ctor(String serviceName, Assembly[] assembliesWithServices) +93

Using NLog 4.5 RC, ServiceStack 5.0.2 assemblies

Sounds like a breaking change with NLog’s RC packages, ServiceStack only updates to use the latest stable packages of external dependencies which you should use instead.

That’s what I figured, problem is 4.5 is needed for .net standard 2 support.

Then you should be able to configure logging via the .NET Core logging abstraction. NLog has some docs on configuring NLog with .NET Core 2.0.

Unfortunately, for now we have to live side by side so our logging needs to work both ways… 4.7.1 and .net core.

We’ll update to the latest stable packages of every release. In the meantime you can just copy the 2 NLog adapter classes into your project which you can use with any version of NLog.

Yeah it looks like you need to inherit from Logger in ServiceStack NLogLogger and provide a default constructor. At least that’s what it looks like anyway.