Skip to content

Blazor (client side) hosted in IIS not working under AspNetCore 3 Preview 6 #11425

Closed
@JoelW187

Description

@JoelW187

If you believe you have an issue that affects the security of the platform please do NOT create an issue and instead email your issue details to secure@microsoft.com. Your report may be eligible for our bug bounty but ONLY if it is reported through email.

Describe the bug

Hosting Blazor apps in IIS doesn't seem to work under Preview 6. I always get the message "This localhost page can’t be found" (in Chrome). The app runs fine in Visual Studio 2019 Preview (16.2.0 Preview 2.0). But when I publish the code to an IIS website I get the error. I'm thinking it has something to do with the new MapFallbackToClientSideBlazor call in Startup.Configure (but that's just a guess).

To Reproduce

Steps to reproduce the behavior:

  1. I installed the preview 6 SDK and the Hosting Bundle (from https://dotnet.microsoft.com/download/dotnet-core/3.0)
  2. In Visual Studio Professional 2019 Preview (16.2.0 Preview 2.0) I created a Blazor hosted project and verified that the Preview 6 packages were referenced. This project runs correctly in Chrome within VS 2019/IIS Express.
  3. Publish the web site (I used a File publish on my local machine) and setup an application in IIS for the site (app pool = No Managed Code, No 32-bit, Integrated, ApplicationPoolIdentity)
  4. Navigate to the new site in Chrome. I get the message "This locahost page can't be found"
  5. If I start the executable (WindowsApplication1.Server.exe) from the command line and navigate to http://localhost:5000 I also get the error message (I swear this worked once but it doesn't work now).

Expected behavior

I expected the site to run

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.
Here's what I get at the command line when I start the executable and navigate to port 5000:
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using 'C:\Users\joel.wilson\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at r
est.
Hosting environment: Production
Content root path: c:\junk\pre6\WebApplication1\WebApplication1.Server\bin\Debug\netcoreapp3.0\publish
Now listening on: http://localhost:5000
Now listening on: https://localhost:5001
Application started. Press Ctrl+C to shut down.
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/1.1 GET http://localhost:5000/
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
Executing endpoint 'Fallback {*path:nonfile}'
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
Executed endpoint 'Fallback {*path:nonfile}'
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished in 41.8796ms 404

It doesn't seem to be routing to the fallback path correctly (which is set in Startup.cs with the following code:
app.UseEndpoints(endpoints =>
{
endpoints.MapDefaultControllerRoute();
endpoints.MapFallbackToClientSideBlazor<Client.Startup>("index.html");
});
)

But, again, it runs fine under IISExpress/Visual Studio 2019 Preview.

dotnetinfo6.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions