假设项目名为MyApp,想要运行的子目录名也叫MyApp
MyApp.csproj
<PropertyGroup>
<StaticWebAssetBasePath>MyApp</StaticWebAssetBasePath>
</PropertyGroup>
Properties/launchSettings.json
"https": {
"commandName": "Project",
"commandLineArgs": "--pathbase=/MyApp",
"launchBrowser": true,
"launchUrl": "MyApp/",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/MyApp/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7270;http://localhost:5238"
}
wwwroot/index.html
<base href="/MyApp/" />
标签:WebAssembly,MyApp,子目录,https,Blazor,localhost
From: https://www.cnblogs.com/Yu-Core/p/18019641