Service Fabric Error: Not authorized to connect

Service Fabric Error: Not authorized to connect

我正在尝试 运行 此处找到的 Service Fabric 示例:

Service Fabric Getting Started Sample

我正在将其加载到 Visual Studio 2017 CE。我已将 Fabric 应用程序设置为启动项目,它似乎可以很好地构建和部署。

Service Fabric 仪表板显示所有内容 运行ning。

但是,当我尝试使用示例 WebService 项目进行连接时,出现以下错误:

WebService> Unhandled Exception: System.Fabric.FabricConnectionDeniedException: Not authorized to connect ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80071C43
WebService>    at System.Fabric.Interop.NativeRuntime.FabricEndGetNodeContext(IFabricAsyncOperationContext context)
WebService>    at System.Fabric.FabricRuntime.NativeFabricRuntimeFactory.GetNodeContextEndWrapper(IFabricAsyncOperationContext context)
WebService>    at System.Fabric.Interop.AsyncCallOutAdapter2`1.Finish(IFabricAsyncOperationContext context, Boolean expectedCompletedSynchronously)
WebService>    --- End of inner exception stack trace ---
WebService>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
WebService>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
WebService>    at Microsoft.ServiceFabric.Services.Runtime.RuntimeContext.<GetOrCreateAsync>d__14.MoveNext()
WebService> --- End of stack trace from previous location where exception was thrown ---
WebService>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
WebService>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
WebService>    at Microsoft.ServiceFabric.Services.Runtime.ServiceRuntime.<RegisterServiceAsync>d__0.MoveNext()
WebService> --- End of stack trace from previous location where exception was thrown ---
WebService>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
WebService>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
WebService>    at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
WebService>    at WebService.Program.Main()

我看到人们从哪里得到这个,因为他们将启动项目更改为 GettingStartedApplication 以外的项目,不幸的是,这不是我的问题。

当我浏览 WebService web.config 时,我找到了用于连接示例应用程序的端口(端口 8081)。我试图在调试模式下启动 WebService 的一个实例(不完全理解该示例的工作原理),这就是我收到错误消息的原因。希望这会对其他人有所帮助。

将 Service Fabric 应用程序(橙色项目)设置为启动项目而不是 .Net 项目,然后错误应该消失