title: Unable to resolve fabric:/ addresses using ServicePartitionResolver. Issue: The remote certificate is invalid according to the validation procedure
body: <p>With multiple applications running in the same Azure Service Fabric cluster, we want to use the ServicePartitionResolver for communication between the services. Given a fabric:/Application/Service url, it should be able to resolve the local cluster url for the same, so that REST calls can happen within the boundary of the server, without the need for making a external exposed URL call.</p>
  
  <p>We have written a utility which converts the above fabric:/ url into a local url, but it returns the URL as the IP of the server in which it is running. Calling the APIs with that URL returns the error.</p>
  
  <p>On making calls from this resolved URL, we get the following SSL error:
  <code>AuthenticationException: The remote certificate is invalid according to the validation procedure.</code></p>
  
  <p>One way to fix this is to disable the certificate validation, which is not a secure way.</p>
  
  <pre><code>var handler = new HttpClientHandler();
  handler.ServerCertificateCustomValidationCallback = (httpRequestMessage, cert, cetChain, policyErrors) =&gt; true;
  </code></pre>
  
  <p>Stack trace for the error coming in the first place:</p>
  
  <pre><code>System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
     at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
     at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
     at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
     at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
     at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
     at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
     at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
     at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
     at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
     at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
     at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
     at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
     at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
     at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
     at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
     at System.Net.Security.SslState.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Net.Security.SslState.ThrowIfExceptional()
     at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
     at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)
     at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
     at System.Net.Security.SslStream.&lt;&gt;c.&lt;AuthenticateAsClientAsync&gt;b__47_1(IAsyncResult iar)
     at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
  </code></pre>