title: Service Fabric Error: Not authorized to connect
body: <p>I am attempting to run a Service Fabric example found here:</p>
  
  <p><a href="https://azure.microsoft.com/en-us/resources/samples/service-fabric-dotnet-getting-started/" rel="noreferrer">Service Fabric Getting Started Sample</a></p>
  
  <p>I am loading it into Visual Studio 2017 CE.  I have set the Fabric app as the startup project and it appears to build and deploy just fine.</p>
  
  <p><a href="https://i.stack.imgur.com/neL73.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/neL73.jpg" alt="Visual Studio 2017 CE"></a></p>
  
  <p>The Service Fabric dashboard shows everything up and running.</p>
  
  <p><a href="https://i.stack.imgur.com/5bWiu.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/5bWiu.jpg" alt="Fabric Dashboard"></a></p>
  
  <p>However, when I try to connect using the example WebService project I get the following error:</p>
  
  <pre><code>WebService&gt; Unhandled Exception: System.Fabric.FabricConnectionDeniedException: Not authorized to connect ---&gt; System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80071C43
  WebService&gt;    at System.Fabric.Interop.NativeRuntime.FabricEndGetNodeContext(IFabricAsyncOperationContext context)
  WebService&gt;    at System.Fabric.FabricRuntime.NativeFabricRuntimeFactory.GetNodeContextEndWrapper(IFabricAsyncOperationContext context)
  WebService&gt;    at System.Fabric.Interop.AsyncCallOutAdapter2`1.Finish(IFabricAsyncOperationContext context, Boolean expectedCompletedSynchronously)
  WebService&gt;    --- End of inner exception stack trace ---
  WebService&gt;    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  WebService&gt;    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  WebService&gt;    at Microsoft.ServiceFabric.Services.Runtime.RuntimeContext.&lt;GetOrCreateAsync&gt;d__14.MoveNext()
  WebService&gt; --- End of stack trace from previous location where exception was thrown ---
  WebService&gt;    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  WebService&gt;    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  WebService&gt;    at Microsoft.ServiceFabric.Services.Runtime.ServiceRuntime.&lt;RegisterServiceAsync&gt;d__0.MoveNext()
  WebService&gt; --- End of stack trace from previous location where exception was thrown ---
  WebService&gt;    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  WebService&gt;    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  WebService&gt;    at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
  WebService&gt;    at WebService.Program.Main()
  </code></pre>
  
  <p>I've seen where people get this because they have changed the startup project to something other than GettingStartedApplication, unfortunately that's not my issue.</p>