NServiceBus endpoint is not starting on Azure Service Fabric local cluster

╄→гoц情女王★ 提交于 2019-12-11 07:31:05

问题


I have a .NetCore stateless WebAPI service running inside Service Fabric local cluster.

 return Endpoint.Start(endpointConfiguration).GetAwaiter().GetResult();

When I'm trying to start NServiceBus endpoint, I'm getting this exception :

Access to the path 'C:\SfDevCluster\Data_App_Node_0\AppType_App10\App.APIPkg.Code.1.0.0.diagnostics' is denied.

How can it be solved ? VS is running under administrator.


回答1:


The issue you are having is because the folder you are trying to write to is not supposed to be written by your application.

The package folder is used to store you application binaries and can be recreated dynamically whenever an application is hosted in the node.

Also, the binaries are reused by multiple service instances running on same node, so it might compete to use the files by different instances.

You should instead instruct your application to write to the WorkFolder,

public Stateless1(StatelessServiceContext context): base(context)
{
   string workdir = context.CodePackageActivationContext.WorkDirectory;
}

The code above will give you a path like this:

'C:\SfDevCluster\Data_App_Node_0\AppType_App10\App.APIPkg.Code.1.0.0.diagnostics\work'

This folder is dynamic, will change depending on the node or instance of your application is running, when created, your application should already have permission to write to it.

For more info, see:

how-do-i-get-files-into-the-work-directory-of-a-stateless-service?forum=AzureServiceFabric




回答2:


  1. Open folder properties Security tab
  2. Select ServiceFabricAllowedUsers
  3. Add Write permission


来源:https://stackoverflow.com/questions/51491529/nservicebus-endpoint-is-not-starting-on-azure-service-fabric-local-cluster

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!