'AspCore 404 on production enviroment
When I create AspCore Hosted Blazor Wasm template project(VS22) and change server's launchSettings.json aspnetcore enviroment to "Production" or delete it entirely, page gets 404. It runs fine on "Development". Am i missing something? Do i need to configure anything else to run the app on production enviroment?
Solution 1:[1]
We don't know the content in your launchSettings.json. And I follow your steps to try, and can't reproduce the issue.
So my suggestion is you need upgrade your VS2022 to latest version first.
- Then you can create another new sample project to test.
- If you not use the latest .net core version, please use .net6. (Same as mine)
My Test Steps:
Delete the environment like below:
{ "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:14136", "sslPort": 44320 } }, "profiles": { "BlazorApp1": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "applicationUrl": "https://localhost:7060;http://localhost:5060", "environmentVariables": { } }, "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { } } } }Run it in VS2022, and it works well.
Publish it, and host in IIS.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

