react/c# - fetch to c# causes Ssl exception

Viewed 54

I perform the following query (sorry for the ill-written code).

(...)
    const res : boolean = await fetch("https://localhost:5001/api/v1/User/?" + new URLSearchParams({login: login, password: password, repeatedPassword: repeatedPassword}), {method: 'POST'})
(...)

for the c# webapi, that is connected to RavenDB.

I get the following exception:

fail: Microsoft.AspNetCore.Server.Kestrel[0]
      Unhandled exception while processing 0HM9Q57V1OER6.
System.IO.IOException: The encryption operation failed, see inner exception.
 ---> Interop+OpenSsl+SslException: Operation failed with error - 5.
   --- End of inner exception stack trace ---
   (...)

What may I do with this? I have tried repeating the same query with Postman, it performs successfully.

1 Answers

Ok, it is strange that this issue appeared. For me, the solution was to comment out the following string in Program.cs:

app.UseHttpsRedirection()

should be

//app.UseHttpsRedirection()
Related