Unable to debug Blazor hosted webassembly 3.2.0 from Visual Studio 2019 16.6.2

后端 未结 5 1278
迷失自我
迷失自我 2021-01-04 12:00

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

相关标签:
5条回答
  • 2021-01-04 12:15

    The problem for me occurs if I select the Configure For HTTPS option when creating the project.


    As a workaround,

    1. for an HTTPS configured project changing is settings-sslport, to 0
    2. applicationUrl to only http://localhost:port in launchsettings.json

    I think the debug adapter has an underlying security related problem. Good luck!

    0 讨论(0)
  • 2021-01-04 12:16

    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)
    ...
    
    0 讨论(0)
  • 2021-01-04 12:19

    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.

    0 讨论(0)
  • 2021-01-04 12:25

    for me I was missing app.UseWebAssemblyDebugging(); in Startup.Configure(). Hope this helps someone.

    0 讨论(0)
  • 2021-01-04 12:28

    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.

    0 讨论(0)
提交回复
热议问题