Reputation: 16194
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 application, I can run it from Visual Studio by pressing Ctrl+F5 and it opens a new tab on my active browser window and starts fine.
But when I press F5, a new, separate browser window is opened (which is midly annoying), but the page remains at about:blank
for a while until an error message appears in Visual Studio:
Failed to launch debug adapter. Additional information may be available in the output window.
Unable to launch browser:
"Could not open wss://localhost:5001/_framework/debug/ws-proxy?browser=wsAFFlocalhostA50821FdevtoolsFbrowserFceed3b95-58ac-470a-b10c-5d139cfd7117": timeout after 60000ms
Whether the Blazor WebAssembly application is "Hosted" or not doesn't make a difference.
I've followed the steps in the Enforce HTTPS in ASP.NET Core, but that made no difference.
If, while waiting for the about:blank
window to crash, I manually open the client side url on a browser tab, the app loads and the debugger breakpoints are hit.
During the short while before it goes on to crash, if I hit Shift+Alt+D I always get the following error:
Unable to find debuggable browser tab
Could not get a list of browser tabs from http://127.0.0.1:9222/json. Ensure your browser is running with debugging enabled.
Resolution
If you are using Microsoft Edge (80+) for your development, follow these instructions:
Press Win+R and enter the following:
msedge --remote-debugging-port=9222 --user-data-dir="C:\Users\sergi\AppData\Local\Temp\blazor-edge-debug" --no-first-run https://localhost:44372/
I get this each and every time, no matter how often I run the command (having closed all browser instances, rebooted, etc).
This happens in both Edge 84 (Edgium) and Chrome.
I should be able to create a new Blazor WebAssembly app and hit F5 on Visual Studio out of the box. What am I missing?
I've just tried using "old Edge" (EdgeHtml) and Firefox as the debug browser in Visual Studio, and both work as expected (meaning that the application at least starts up when pressing F5). The problem apears to be both Chromium-based browsers then...
@JamesHancock posted an easy enough workaround in the comments. For a full resolution (and explanation), I've logged a Github issue with the ASP.NET Core team.
Upvotes: 19
Views: 19132
Reputation: 186
Couple things that this can be related to:
Manually deleting the bin folders in my projects and then rebuilding the app, fixed it for me.
Our app was using SSO and when our organization password reset requirement was reached, and we changed our passwords, we could not launch/access the app (our app was a WASM).
Upvotes: 0
Reputation: 5724
Having this issue for a while now (browser being launched but "stuck" in "about:blank"). Eventually, for me it turned out to be the usage of webHostBuilder.UseUrls
in the application startup.
As soon as I comment out this line, debugging immediately works.
Upvotes: 0
Reputation: 31
I got this problem today, follow the correct answer:
app.UseWebAssemblyDebugging();
app.UseBlazorFrameworkFiles();
theses lines should exists in the server project. Attention to the app.UseWebAssemlyDebugging, it must be before the app.UseBlazorFrameworkFiles.
preferable put the app.UseWebAssemblyDebugging inside the Development enviroment check, so it will not deploy to production.
also these two lines must be placed before the lines app.UseStaticFiles(); and app.UseRouting();
Following these rules, everything will run properly and the process will stop at the break point in blazor wasm as expected.
Upvotes: 1
Reputation: 433
I had the following configurations
.NET - 6
Visual Studio 2022 Community edition
Browser - Google Chrome
I have tried all of the solutions above. But none worked for me. Then I tried changing the browser from Chrome to Firefox. Firefox gave me a different error message and it was pointed towards updating .Net version.
I simply updated VS 2022 from version 17.3.3 to 17.3.5 and problem solved. Hope someone will find this helpful
Upvotes: 1
Reputation: 101
I had this issue as well and I solved it by unticking "Enable SSL" under "Web Server Settings" in project properties.
Obviously disabling SSL is undesirable is nearly all situations but works in my use case.
For a better solution if you're developing on Windows 7 check you have the KB installed that has modern TLS needed for IIS SSL which caused problems with SSL in non chromium browsers.
Upvotes: 1
Reputation: 614
Had a project that loaded perfectly fine. Left it for a couple of weeks and when I opened it again tonight, I got this issue.
In launchsettings.json I had this (all default values from the project template, I hadn't changed anything)
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
I removed this line
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
Pressed F5 and it worked!
And then I inserted it again and it still works.
Upvotes: 11
Reputation: 21
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!
Upvotes: 2
Reputation: 1245
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)
...
Upvotes: 0
Reputation: 605
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).
Upvotes: 5
Reputation: 3547
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.
Upvotes: 5
Reputation: 111
for me I was missing app.UseWebAssemblyDebugging();
in Startup.Configure()
. Hope this helps someone.
Upvotes: 11