title: 'Failed to authenticate HTTPS connection' while accessing ASP.NET Core 2.1 Web API from React Native
body: <p>I have an ASP.NET Core 2.1 Web API project that is serving data from an SQL Server database. I checked 'Configure for HTTPS' option while I was creating the API project in Visual Studio.</p>
  
  <p>I need to access this API from a React Native project, and I have tried using the <code>Fetch</code> API for it. The method I am using works when I make REST requests to different APIs but it is not working for my own API project. When I make a simple GET request to the API, I receive a <code>Network request failed</code> error on my mobile device, while on the API end, following error stack is encountered:</p>
  
  <pre><code>dbug: HttpsConnectionAdapter[1]
        Failed to authenticate HTTPS connection.
  System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---&gt; System.ComponentModel.Win32Exception: An unknown error occurred while processing the certificate
     --- End of inner exception stack trace ---
     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.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.EndAuthenticateAsServer(IAsyncResult asyncResult)
     at System.Net.Security.SslStream.&lt;&gt;c.&lt;AuthenticateAsServerAsync&gt;b__51_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 Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionAdapter.InnerOnConnectionAsync(ConnectionAdapterContext context)
  </code></pre>
  
  <p>However, the request works fine when I make it using Postman, and following is the result:</p>
  
  <pre><code>info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
        Request starting HTTP/1.1 GET https://localhost:5001/api/values application/json
  info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[2]
        Successfully validated the token.
  info: Microsoft.EntityFrameworkCore.Infrastructure[10403]
        Entity Framework Core 2.1.1-rtm-30846 initialized 'DataContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None
  info: Microsoft.EntityFrameworkCore.Database.Command[20101]
        Executed DbCommand (62ms) [Parameters=[@__get_Item_0='?' (DbType = Int32)], CommandType='Text', CommandTimeout='30']
        SELECT TOP(1) [e].[id], [e].[pw], [e].[pws], [e].[em]
        FROM [ul] AS [e]
        WHERE [e].[id] = @__get_Item_0
  info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
        Route matched with {action = "Get", controller = "Values"}. Executing action Api.Controllers.ValuesController.Get (Api)
  info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1]
        Authorization was successful.
  info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
        Executing action method Api.Controllers.ValuesController.Get (Api) - Validation state: Valid
  info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
        Executed action method Api.Controllers.ValuesController.Get (Api), returned result Microsoft.AspNetCore.Mvc.ObjectResult in 0.4905ms.
  info: Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor[1]
        Executing ObjectResult, writing value of type 'System.String[]'.
  info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
        Executed action Api.Controllers.ValuesController.Get (Api) in 30.7297ms
  info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
    Request finished in 125.3707ms 200 application/json; charset=utf-8
  </code></pre>
  
  <p><strong>Additional info:</strong></p>
  
  <p>When I run the API project, following dialogue box appears:</p>
  
  <p><a href="https://i.stack.imgur.com/T4CjJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T4CjJ.png" alt="Would you like to trust the ASP.NET Core SSL certificate"></a></p>
  
  <p>Clicking Yes results in: </p>
  
  <p><a href="https://i.stack.imgur.com/ftqt0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ftqt0.png" alt="Access Control List (ACL) structure is invalid"></a></p>
  
  <p>What is the reason for this error and how should I go about solving this issue? </p>