I have a simple .NET 8 Blazor application that I have to deploy on IIS version 10. I have installed .NET 8 on the server.
The Application Pool is configured as "No Managed code", but I also tried with the .NET CLR Version v4.0.30319.
I checked all the roles for the Web Server, and here is the screenshot of the services that are installed.
I created a new project out-of-the-box without anything else, using the "Interactive render mode" set to "Auto".
Because the application is running under a Web Application in IIS, I added in the appconfig.json the key BasePath to specified the path. For example, if the URL is https://myserver/test the BasePath is /test/. In the App.razor, I added this check
@inject IConfiguration Configuration@{ var basePath = Configuration["BasePath"] ?? "/"; basePath = basePath.EndsWith("/") ? basePath : basePath +"/";}<base href="@basePath" />Locally, the project is working fine. I deploy via Azure DevOps pipeline, the application to the server, and the task is like that (buildConfiguration is Release)
- task: DotNetCoreCLI@2 displayName: Build project inputs: command: 'build' projects: '**/RiskExcessTool.csproj' arguments: '--configuration $(buildConfiguration) -o $(Build.StagingDirectory)/ci-build'Now, I open the application on the server, and I get this page without CSS
So, I opened the Dev Tools to inspect the issue. I can see that Blazor is doing its magic. All the tags have a Blazor identifier.
When I check the console, the CSS are not found. In particular, the RiskExcessTool.style.css is the CSS that Blazor should generate.
Here I can see that the blazor.web.js is loaded.
but the CSS isolation is not working.
When I add a component that has CSS and JS, those files are not found too. As a last resort, I deployed the application to one of my personal servers and the application is working fine. So, I think the issue is in the configuration on the IIS.
How can I resolve this issue?








