Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Blazor] Preview 6 blazorhosted project publish is broken #11185

Closed
stavroskasidis opened this issue Jun 13, 2019 · 15 comments
Closed

[Blazor] Preview 6 blazorhosted project publish is broken #11185

stavroskasidis opened this issue Jun 13, 2019 · 15 comments
Assignees
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed

Comments

@stavroskasidis
Copy link

Describe the bug

Using preview 6 sdk/templates, when publishing a blazor hosted project, publish output seems broken and trying to run the published app does not work

To Reproduce

Steps to reproduce the behavior:

  1. dotnet new blazorhosted -o HostedTest
  2. cd HostedTest\HostedTest.Server
  3. dotnet publish -c Release -o bin\release\publish
  4. cd bin\release\publish
  5. dotnet HostedTest.Server.dll
  6. Navigate to http://localhost:5000 => 404

Additional context

It seems that the publish output folder is not right. For example the index.html file is missing from the HostedTest.Client\dist folder.
Here is the kestrel log of the request

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 27.119500000000002ms 404
@danroth27 danroth27 added the area-blazor Includes: Blazor, Razor Components label Jun 13, 2019
@conficient
Copy link
Contributor

Perhaps this is the same as/related to #10878 and #11088 ?

@danroth27 danroth27 added the bug This issue describes a behavior which is not expected - a bug. label Jun 14, 2019
@danroth27 danroth27 added this to the 3.0.0-preview7 milestone Jun 14, 2019
@danroth27
Copy link
Member

@mkArtakMSFT Please assign

@stsrki
Copy link
Contributor

stsrki commented Jun 14, 2019

I can confirm the same problem has happened to me. To fix the error I had to manually copy all of the files in the wwwroot to my production server.

@kant2002
Copy link
Contributor

kant2002 commented Jun 21, 2019

Workaround for that for me was following

#if DEBUG
endpoints.MapFallbackToClientSideBlazor<Client.Startup>("index.html");
#else
endpoints.MapFallbackToClientSideBlazor<Client.Startup>("_content/client_project_name/index.html");
#endif

@danroth27 danroth27 added External This is an issue in a component not contained in this repository. It is open for tracking purposes. and removed External This is an issue in a component not contained in this repository. It is open for tracking purposes. labels Jun 21, 2019
@danroth27 danroth27 assigned javiercn and unassigned pranavkm Jun 21, 2019
@smartprogrammer93
Copy link

Is there a work around to fix this. even though i made the site work on kestral. i cant make the iis version work

@mkArtakMSFT
Copy link
Member

@smartprogrammer93, have you tried the workaround provided by @kant2002 above?

@smartprogrammer93
Copy link

@mkArtakMSFT yes. It only worked with kestral but not with IIS. I even copied the content of the folder to the wwroot. And that made kestral work but not IIS

@mkArtakMSFT mkArtakMSFT modified the milestones: 3.0.0-preview7, 3.1.0 Jun 23, 2019
@mkArtakMSFT
Copy link
Member

Not really sure this is the same, but have you tried the workaround described here: https://github.com/aspnet/websdk/issues/604

@mkArtakMSFT
Copy link
Member

@danroth27, I moved this out to 3.1, as the other related/similar issues are in there already and we can't fit this in current milestone.

@smartprogrammer93
Copy link

@mkArtakMSFT i will try this workaround when i have the time. Please note that moving this issue to to 3.1 milestone means that client blazor apps will never be able to be hosted in IIS which a lot of us use. I argue guys to reconsider.

@acorrow
Copy link

acorrow commented Jun 25, 2019

@mkArtakMSFT i will try this workaround when i have the time. Please note that moving this issue to to 3.1 milestone means that client blazor apps will never be able to be hosted in IIS which a lot of us use. I argue guys to reconsider.

I could not agree more. It seems like it would be a huge miss to move this to 3.1, it's not like this is a feature request to get publishing into IIS, this is a regression bug. Preview 5 worked just fine with IIS publishing.

@javiercn
Copy link
Member

I believe this is actually fixed as per my changes in 0a4f42a.

@javiercn javiercn modified the milestones: 3.1.0, 3.0.0-preview7 Jun 25, 2019
@javiercn javiercn added the Done This issue has been fixed label Jun 25, 2019
@FluentGuru
Copy link

Workaround for that for me was following

#if DEBUG
endpoints.MapFallbackToClientSideBlazor<Client.Startup>("index.html");
#else
endpoints.MapFallbackToClientSideBlazor<Client.Startup>("_content/client_project_name/index.html");
#endif

This works but you also need to do the same for the static files

@dustinlacewell
Copy link

@FluentGuru Hey, I'm just starting out with all of this. I got the MapFallbackToClientSideBlazor DEBUG snippet above working for me. But my site has no static files. Where and what do I change in order to do the same for static files as you say?

@FluentGuru
Copy link

@FluentGuru Hey, I'm just starting out with all of this. I got the MapFallbackToClientSideBlazor DEBUG snippet above working for me. But my site has no static files. Where and what do I change in order to do the same for static files as you say?

@DustinCampbell you must add this part too if you are using static files found inside your blazor project folder

app.UseStaticFiles(new StaticFileOptions()
            {
                FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/_content/{blazorprojectname}")),
                RequestPath = new PathString("")
            }); 

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed
Projects
None yet
Development

No branches or pull requests