NService Bus Access Denied when logging within service Fabric

0

I have an issue that has come up out of nowhere in NServiceBus

System.UnauthorizedAccessException
  HResult=0x80070005
  Message=Access to the path 'd:\SfDevCluster\Data\_App\_Node_0\PATH\.diagnostics' is denied.
  Source=mscorlib
  StackTrace:
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
   at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
   at NServiceBus.HostStartupDiagnostics.BuildDefaultDiagnosticsWriter(ReadOnlySettings settings)
   at NServiceBus.HostStartupDiagnostics.GetDiagnosticsWriter(ReadOnlySettings settings)
   at NServiceBus.HostStartupDiagnostics.Setup(FeatureConfigurationContext context)
   at NServiceBus.Features.FeatureActivator.ActivateFeature(FeatureInfo featureInfo, List`1 featuresToActivate, IConfigureComponents container, PipelineSettings pipelineSettings, RoutingComponent routing, ReceiveConfiguration receiveConfiguration)
   at NServiceBus.Features.FeatureActivator.SetupFeatures(IConfigureComponents container, PipelineSettings pipelineSettings, RoutingComponent routing, ReceiveConfiguration receiveConfiguration)
   at NServiceBus.InitializableEndpoint.<Initialize>d__1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NServiceBus.Endpoint.<Start>d__1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Inspired.CommonConfiguration.<ApplyEndpointConfigurationAndStartEndpointAsync>d__3.MoveNext() in C:\Source\Inspired.TradingPlatform\src\Inspired.TradingPlatform.NServiceBus\Extensions\CommonConfiguration.cs:line 113

How can I set the permissions to allow the log file to be created?

I have never had this issue before, no idea why it has suddenly started

I dont even want logging really, so I am happy to just disable it, I just any solution to get round this error as I need to get on with other stuff

I have tried the logic below to disable logging but it has not made any difference

This is called BEFORE I start up my end point

var config = new LoggingConfiguration();
NLog.LogManager.Configuration = config;
NServiceBus.Logging.LogManager.Use<NLogFactory>();

This is happening on a local 1 node dev cluster. It looks like this is being run under network service account. This user has full permissions

Cheers

Paul

c#
azure-service-fabric
nservicebus
asked on Stack Overflow Aug 18, 2018 by Paul

1 Answer

0

This happens because your application does not have permission to write in the folder d:\SfDevCluster\Data\_App\_Node_0\PATH\.diagnostics

You should configure the logger to use your application work directory for storing thse logs, take a look on this other SO question: NServiceBus endpoint is not starting on Azure Service Fabric local cluster

Keep in mind, that the folder is temporary and can be deleted at any point when you service is removed from the node.

answered on Stack Overflow Aug 23, 2018 by Diego Mendes

User contributions licensed under CC BY-SA 3.0