Skip to content

Commit f8cbcde

Browse files
authored
Debug WASM w/o changing base href (#19977)
* Debug WASM w/o changing base href * Add NOTE to improve cross-link to app base path content * Update
2 parents 6ffed01 + e671afe commit f8cbcde

1 file changed

Lines changed: 47 additions & 3 deletions

File tree

aspnetcore/blazor/debug.md

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,55 @@ While debugging a Blazor WebAssembly app, you can also debug server code:
9393
> [!NOTE]
9494
> Breakpoints are **not** hit during app startup before the debug proxy is running. This includes breakpoints in `Program.Main` (`Program.cs`) and breakpoints in the [`OnInitialized{Async}` methods](xref:blazor/components/lifecycle#component-initialization-methods) of components that are loaded by the first page requested from the app.
9595
96-
# [Visual Studio Code](#tab/visual-studio-code)
96+
If the app is hosted at a different [app base path](xref:blazor/host-and-deploy/index#app-base-path) than `/`, update the following properties in `Properties/launchSettings.json` to reflect the app's base path:
97+
98+
* `applicationUrl`:
99+
100+
```json
101+
"iisSettings": {
102+
...
103+
"iisExpress": {
104+
"applicationUrl": "http://localhost:{INSECURE PORT}/{APP BASE PATH}/",
105+
"sslPort": {SECURE PORT}
106+
}
107+
},
108+
```
109+
110+
* `inspectUri` of each profile:
111+
112+
```json
113+
"profiles": {
114+
...
115+
"{PROFILE 1, 2, ... N}": {
116+
...
117+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/{APP BASE PATH}/_framework/debug/ws-proxy?browser={browserInspectUri}",
118+
...
119+
}
120+
}
121+
```
122+
123+
The placeholders in the preceding settings:
124+
125+
* `{INSECURE PORT}`: The insecure port. A random value is provided by default, but a custom port is permitted.
126+
* `{APP BASE PATH}`: The app's base path.
127+
* `{SECURE PORT}`: The secure port. A random value is provided by default, but a custom port is permitted.
128+
* `{PROFILE 1, 2, ... N}`: Launch settings profiles. Usually, an app specifies more than one profile by default (for example, a profile for IIS Express and a project profile, which is used by Kestrel server).
97129

98-
<a id="vscode"></a>
130+
In the following examples, the app is hosted at `/OAT` with an app base path configured in `wwwroot/index.html` as `<base href="/OAT/">`:
131+
132+
```json
133+
"applicationUrl": "http://localhost:{INSECURE PORT}/OAT/",
134+
```
135+
136+
```json
137+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/OAT/_framework/debug/ws-proxy?browser={browserInspectUri}",
138+
```
139+
140+
For information on using a custom app base path for Blazor WebAssembly apps, see <xref:blazor/host-and-deploy/index#app-base-path>.
141+
142+
# [Visual Studio Code](#tab/visual-studio-code)
99143

100-
## Debug standalone Blazor WebAssembly
144+
<h2 id="vscode">Debug standalone Blazor WebAssembly</h2>
101145

102146
1. Open the standalone Blazor WebAssembly app in VS Code.
103147

0 commit comments

Comments
 (0)