nader2929
nader2929

Reputation: 141

Can't run a specific ASP.NET project on my machine. Both Rider and VS2019

Cannot send a DEBUG request to IIS Express (exception: An error occurred while sending the request., reason: System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> 
System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> 
System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> 
System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult) at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult) 
--- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult) at System.Net.Connection.ReadCallback(IAsyncResult asyncResult) 
--- End of inner exception stack trace --- at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar) 
--- End of inner exception stack trace --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at JetBrains.ReSharper.Host.Features.IisIntegration.IisExpressHost. d__14.MoveNext()). It may indicate an invalid "applicationUrl" parameter in your launchSettings.json. Please check your settings.

That the error message I get from Rider when it fails to run. VS2019 doesn't give an error message but I only used it to test if it was the IDE or the project.

The projects inside the solution are all using netcoreapp2.2.

I have narrowed it down to what I think is an error in with when Rider tries to setup SSL for the project.

Not sure what else to include with this, if there is something I can include or a file I can be pointed to to look at let me know.

Running the Project instead of Debugging allows me to access the site by going to the URL but obviously this is far from ideal as I need debugging tools.

Upvotes: 3

Views: 2526

Answers (2)

Alessio Di Salvo
Alessio Di Salvo

Reputation: 281

In addition to Set up ASP.NET Core Developer Certificate in Rider, you can try these commands to recreate the certificate:

dotnet dev-certs https --clean

dotnet dev-certs https

dotnet dev-certs https --trust

or delete the localhost certificate from the Keychain Access if you are using a Mac.

Source: https://dev.to/cesarcodes/troubleshooting-net-core-dev-certs-on-macos-179d

Upvotes: 1

nader2929
nader2929

Reputation: 141

Figured it out. So in my case this happened becuase Rider has its own SSL certificate that is uses when setting up the SSL on the projects running locally that was not installed on my machine. The error message however does not give any indication of this.

To install the ASP.NET Core certificate that it needs do the following (instructions from here).

  1. Hit Ctrl+T
  2. Click on the "Actions" tab
  3. Search for "set up certificate"
  4. Click on "Set up ASP.NET Core Developer Certificate"

Upvotes: 6

Related Questions