简体   繁体   English

在服务结构中登录时,NService总线访问被拒绝

[英]NService Bus Access Denied when logging within service Fabric

I have an issue that has come up out of nowhere in NServiceBus 我有一个问题在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. 这是在本地1节点开发集群上发生的。 It looks like this is being run under network service account. 看起来这是在网络服务帐户下运行的。 This user has full permissions 该用户拥有完整权限

Cheers 干杯

Paul 保罗

This happens because your application does not have permission to write in the folder d:\\SfDevCluster\\Data\\_App\\_Node_0\\PATH\\.diagnostics 发生这种情况是因为您的应用程序无权写入文件夹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 您应该配置记录器以使用您的应用程序工作目录来存储这些日志,然后查看另一个SO问题: NServiceBus终结点不在Azure Service Fabric本地群集上启动

Keep in mind, that the folder is temporary and can be deleted at any point when you service is removed from the node. 请记住,该文件夹是临时的,可以在从节点删除服务时随时删除该文件夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM