Routing And Links Not Working When Publishing Razer Page CRUD Application

Tweedy, Danny 0 Reputation points
2023-06-23T15:18:27.31+00:00

I'm having a routing and link generation issue with a CRUD application that I created Visual Studio 2022 in Razer Pages.

The application runs fine in Visual Studio, the all links generated from the asp-page tag helper are created as expected, and you can navigate to all the pages via the links in the buttons just fine. However, when the application is published to a local folder (or a folder on test/staging server) and run from IIS, links for any page that is NOT the index page in the root subfolder are not being generated AND the routing doesn't appear to be working, as evidenced when you try to get to a page by simply typing the full url to the page you want to get to (eg.http://localhost:88/Solutions/Create ); you simply get the HTTP ERROR 404 "This localhost page can’t be found" error.

Here is a snapshot of the link as it's generated when the app is run (just fine) from Visual Studio:

LinkGood

Here is what the link looks like when from from IIS after publishing the app into a folder on my machine (Note: The same occurs if published local to the IIS Web Server):

BadLink

And again, if you force the path after run in IIS you get the 404 error, suggesting the routing just isn't working:

PageNotFound

Everything is present in the application code necessary for routing and link generation, otherwise the links wouldn't generate and routing wouldn't work when run from within Visual Studio, so I'm guessing that some additional configuration is needed in IIS?

The application is built using ASP.NET Core 7:

dotnet_info

Any tips, suggestions, or guidance would be greatly appreciated.

Thanks!

Developer technologies | ASP.NET | ASP.NET Core
Developer technologies | Visual Studio | Other
{count} votes

1 answer

Sort by: Most helpful
  1. Tweedy, Danny 0 Reputation points
    2023-06-26T13:12:47.3266667+00:00

    These already exist in my _ViewImports.cshtlm, always have:

    ViewImports


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.