it was deployed in sub directory
See the docs for how to configure a Blazor application deployed to an IIS sub application. App base path
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
We upgraded our Blazor server app to .Net 8 from .Net 6. by folowing the instructions. we changed the blazor.server.js to blazor.web.js. everything works good from visual studio IDE using IIS express. After the application is deployed to our test server, we get the error GET https://my domain.com/_framework/blazor.web.js net::ERR_ABORTED 404 (Not Found). I swtiched to see blazor.server.js works or not, I get a different error. I have installed the nuget package Microsoft.aspnetcore.component.web(8.0.1) and referenced to the project. Any help is appreciated.
it was deployed in sub directory
See the docs for how to configure a Blazor application deployed to an IIS sub application. App base path
Hi, It works well in VS IDE, but when hosted on the server in IIS, it does not work as it could not find the resource blazor.web.js.
Here is what I did, I created a brand new Blazor Web App with .Net 8 using the "Blazor Web App" template.
No changes were made. I took the application as it was created.
Worked well in IIS Express locally via VS IDE.
Published it and deployed on our Test IIS Server. I'm getting the same Resource not found on many things.
Here is my generated APP.razor code <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <base href="/" /> <link rel="stylesheet" href="bootstrap/bootstrap.min.css" /> <link rel="stylesheet" href="app.css" /> <link rel="stylesheet" href="TestBlazorWebApp.styles.css" /> <link rel="icon" type="image/png" href="favicon.png" /> <HeadOutlet @rendermode="InteractiveServer" /> </head> <body> <Routes @rendermode="InteractiveServer" /> <script src="_framework/blazor.web.js"></script> </body> </html>
I think the issue is in app.razor code that I pasted in my previous reply. the line that causes the issue is <base href="/" /> In localhost the url is https://localhost:<port number/ whereas when I deployed. it was deployed in sub directory https://mysite.com/myDir so, when I changed in the App.Razor <base href="/myDir/" />. it worked. Prior to upgrade I used to have this <base href="~/" />, it seemed to work, but not anymore. I cannot hard code the sub directory in the app razor because production deployment could be any folder. Any suggestions?