asp.net-corevisual-studio-2022blazor-webassemblytunneling

Visual Studio 2022 is unable to attach debugger when running multiple projects via dev tunnel


I have a solution consisting (among others) of a web API app and a Blazor WASM app. The REST API has to communicate with other servers and finally get some feedback from then, thus for debugging I wanted to use a dev-tunnel in Visual Studio 2022. The tunnel was set to "Temporary" and access was set to "public".

The only particular thing about my application is that instead of a "ASP.NET Core Hosted" app, my blazor and API projects where created independently from each other. I have set everything up to work correctly (CORS, etc) however as far as I understand the difference is, that they operate on different ports locally.

When using a dev tunnel this leads to the following issue for the blazor application (on startup the blazor app does nothing, browser starts stays on about:blank until this error appears):

enter image description here

The error makes perfect sence, since the tunnel actually uses a different address based on the apis port, which is 7200:

https://0jdvzw4r-7200.euw.devtunnels.ms/swagger/index.html

Question now is, how can I set the correct address? Inspecting the dev tunnel window, it already recognizes that two different ports are used:

enter image description here

Alternatively I could also live with disabling the tunnel for the Blazor app completely, since it is not necessary to be reachable by anything atm.

EDIT: Tried to delete the tunnel, create a new one and launch the blazor app alone. This results in the same issue, so maybe problem is not the multiple startup projects.


Solution

  • Find the launchSettings.json file and delete/comment this inspectUri, like below.

    enter image description here

    Then run it and it will works properly without any issue.

    enter image description here


    I know what is inspectUri settings, if you are interested in this issue, you can follow this github issue which has been assigned to the MS Expert.