如何在IIS的子文件夹中托管Blazor服务器应用程序?

时间:2020-09-05 02:32:52

标签: asp.net-core iis blazor-server-side

我想在IIS的子文件夹中部署Blazor服务器应用程序。我跟随https://docs.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/?view=aspnetcore-3.1&tabs=visual-studio#publish-the-app设置了appbasepath。

托管网址:http:// localhost / testApp

资源正像这样http://localhost/testApp/css/style.css一样正确加载。 它加载登录页面,成功登录后,我使用NavigationManager.NavigateTo("/index")重定向到索引页面。

Url必须为http:// localhost / testApp / index,但URL变为http:// localhost / index,因此无法加载页面。我进行了故障排除,发现如果我通过了NavigationManager.NavigateTo("/testApp/index"),那么它可以按预期工作。但是我担心然后我需要强行附加这个/ testApp来指向其他URL。

任何人都可以协助在IIs子文件夹中托管blazor服务器应用程序。

0 个答案:

没有答案