I am using Microsoft Visual Studio 2019 Community preview, version 16.4.0 Preview 1.0. I just update to Windows 10 Pro Version 1903 OS build 18362.418 . With ASP.NET Core 3 web-app project (Blazor Server), When I press F5, I catch error
I can go to https://localhost:44333/ manually, but it is inconvenient. When I stop debug, I also turn off it manually at taskbar.
With another web-app project, the problem is not happen.
When I choose or not choose option Enable native code debugging
, not success.
How to fix it?
Enable/disable SSL
This is the easy fix. For me, toggling the "Enable SSL" setting in the project Debug tab inside Visual Studio (just change it to the opposite of what is currently set and run the project) has fixed the issue.
As I understand it, there are two reason this might work. First it causes Visual Studio to update the Applicationhost Config (more about that later). Secondly, sometimes the SSL address is bound. Therefore disabling SSL disables the problem.
Applicationhost Config
Open your $(solutionDir)\.vs\config\applicationhost.config
file and ensure your site looks like this:
<site name="[YOUR PROJECT NAME]" id="3">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="//PATH/TO/YOUR PROJECT" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:[YOUR_PORT]:localhost" />
<binding protocol="https" bindingInformation="*:[YOUR_SSL_PORT]:localhost" />
</bindings>
</site>
Make sure iplisten is configured to 0.0.0.0
If the IP listen list is not configured, this issue may occur (caution, I have no idea why).
Check netsh to ensure there is an entry for 0.0.0.0
PS C:\Windows\system32> netsh http show iplisten
IP addresses present in the IP listen list:
-------------------------------------------
::
0.0.0.0
PS C:\Windows\system32>
Add the correct netsh rule if it does not exists. You'll need an admin cmd.exe or admin PowerShell for this.
PS C:\Windows\system32> netsh http add iplisten ipaddress=0.0.0.0
Ensure nothing is binding to the address you are using
This seems to be an issue with Blazor for me. If an address is binded to the address Blazor is trying to use, this can cause issues. Use netsh
again to check what is in use.
netsh http show urlacl
An entry that looks like this
Reserved URL : http://*:50902/
User: \Everyone
Listen: Yes
Delegate: No
SDDL: D:(A;;GX;;;WD)
Can be deleted with this command
netsh http del urlacl url=http://*:50902/