Reputation: 75
I want to deploy a Blazor server app in IIS's sub folder. I followed https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/?view=aspnetcore-3.1&tabs=visual-studio#publish-the-app to set appbasepath.
hosted url: http://localhost/testApp
Resources are loading correctly as http://localhost/testApp/css/style.css
like that.
It loads login page, after successful login i redirect to index page using NavigationManager.NavigateTo("/index")
.
The Url must be http://localhost/testApp/index but the url become http://localhost/index so it is failed to load a page. I troubleshoot and found if i pass NavigationManager.NavigateTo("/testApp/index")
then it works as expected. But I worried then i need to forcibly append this /testApp to point other URLs.
Could anyone please assist to host blazor server app in IIs sub folder.
Upvotes: 0
Views: 2539
Reputation: 51
I am pretty sure, you've found the answer to the question by now, but just in case, if it is still of interest to someone - you should remove leading "/" in the .NavigateTo.
Upvotes: 2