aspnetcore-angular-universal icon indicating copy to clipboard operation
aspnetcore-angular-universal copied to clipboard

Routing does not work on IIS deployment

Open codehippie1 opened this issue 9 years ago • 7 comments

Hi Mark,

First of all, thanks for this great piece of work.

Issue: After deploying under IIS as an application(Using MSDeploy) running on an app pool(No managed code) under "Default Website", routing is broken and gives 404. Interestingly I have deployed the "https://github.com/aspnet/JavaScriptServices" as is similarly and routing works fine. Is there anything you are doing with respect to routing from JavascriptServices(Angular)

codehippie1 avatar Sep 13 '17 16:09 codehippie1

@codehippie1 what does your Startup.cs routing section look like?

isaacrlevin avatar Sep 13 '17 18:09 isaacrlevin

I deployed an exact copy of this repository. Did not change any code. My startup.cs is same as https://github.com/MarkPieszak/aspnetcore-angular2-universal/blob/master/Startup.cs

codehippie1 avatar Sep 13 '17 21:09 codehippie1

Is ASPNETCORE_ENVIRONMENT=Development set ? Hmm I'm not sure what would be causing IIS to do that. We have a few different setups here to handle /api routes, swagger, etc, but that shouldn't really affect routing for IIS like that.

I'm wondering if the ClientApp folder or something wasn't moved over when you published it to IIS. It might be something missing from the csproj. Is this with a very recent copy of the repo? @codehippie1

MarkPieszak avatar Sep 14 '17 13:09 MarkPieszak

  1. Is ASPNETCORE_ENVIRONMENT=Development set? - Yes
  2. Is this with a very recent copy of the repo? - Yes, It is the same repo as of today. I just downloaded and published the latest code from https://github.com/MarkPieszak/aspnetcore-angular2-universal now.

Steps to reproduce.

  1. Download repo https://github.com/MarkPieszak/aspnetcore-angular2-universal
  2. Open in VS 2017
  3. Compile and publish to a web deploy package(Release configuration)
  4. Add an application in IIS manager(IIS 7.5 or above) under default website running on an app pool with no managed code.
  5. Deploy the msdeploy package(zip)
  6. Browse the website locally or from a remote machine, click on counter menu, then hit browser refresh button. Page results in 404 with error stating StaticFileHandler.

codehippie1 avatar Sep 14 '17 16:09 codehippie1

@MarkPieszak Did I provide adequate info? Have you got a chance to reproduce the issue?

codehippie1 avatar Nov 02 '17 14:11 codehippie1

Hi, i had some issues with routing when deployed on IIS because i needed routing to call sub-folder. To resolve it, i have simply used ui-router that make à perfect job without using url redirect or complicated configuration. Give a try to ui-router, i hope it will solve your issue.

JulienBroutier avatar Nov 05 '17 13:11 JulienBroutier

If you are still using the old version, you have to deploy from a very specific location on IIS. My .csproj is located in "C:\development\costbooks" so, go from there for reference as to what file to deploy.

image

After testing, yes, the folder should look similar to the one I have in the picture, the "dotnet publish" command compiles the app into that folder, I believe.

Adondriel avatar Dec 21 '17 20:12 Adondriel