Home > Enterprise >  Blazor Server App routing 404 - File or directory not found
Blazor Server App routing 404 - File or directory not found

Time:01-20

I have created a blazor server app. it is working on my machine when it is running using localhost. There is a folder configured in the IIS for this project.

I have published the project to a folder and then copied/paste the dll files to the configured folder in the IIS.

The main page (index page) is running perfect , but when I tried to click to move to another page, I got the error "404 - File or directory not found".

Note :- when I browse the project from the IIS , the name of the project has been replaced from localhost to abcdef.com.

Could anyone help me to correct the routing problem ?

CodePudding user response:

I think its related to your page definition of your Balzor components. "/" means the root folder of your website. If you want to add this application to your existing website, you probably upload it in a new folder in your host. For example https yourwebsite/app. In this scenario your new application is not root of your website anymore. So your page address should be something like this: @page "/app/address".

  •  Tags:  
  • Related