I have Visual Studio 2019 16.6.2 installed, along with the .NET Core 3.1.301 SDK and all the necessary Blazor templates.
If I create a brand new Blazor WebAssmbly app
The problem for me occurs if I select the Configure For HTTPS option when creating the project.
As a workaround,
settings-sslport
, to 0
applicationUrl
to only http://localhost:port
in launchsettings.json
I think the debug adapter has an underlying security related problem. Good luck!
This sounds extremely naïve but this was the entire problem for me. I didn't notice this line was removed in the diff.
Make sure your main builds and runs the CreateHostBuilder
function.
This unfortunately causes the same error above but is not at all directly related.
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
...
public static IHostBuilder CreateHostBuilder(string[] args)
...
It appears that the issue is that if you remove the IIS Express section from the launchSettings.json file of your project, that debugging will then fail to work. And this is true even if you're using VS code against the project directly without IIS proxying or VS.net too.
So the solution is to put back the IIS Express section in the launchsettings.json file and not remove it until this is fixed.
for me I was missing app.UseWebAssemblyDebugging();
in Startup.Configure()
. Hope this helps someone.
After searching for couple of days, I did the following and it worked like charm:
1.Install IE "Microsoft edge"
2.Use IE "Microsoft edge" as your VS. browser (NOT CHROME)
3.Use your application as server (NOT IIS EXPRESS).
Enjoy.