This question is related to Angular2+ (not AngularJS)
We are trying to host our angular site under a virtual directory under a website on IIS.
We have a Website Called Development that points to: C:\inetpub\wwwroot\Development.
In this folder we have another folder called Web
. This Web folder holds the angular site code (built with ng build --base-href "/Web" --deploy-url "/Web"
When we navigate to http://server/Web, everything seems to be loading fine, except for the 0.chuck.js file. For some reason this file is being requested as:
http://server/Web0.chuck.js
It seems like the "/" is missing before the 0, but I'm not sure where this setting could be handled.
Any ideas?
The Angular Router is a fantastic module for Single Page Apps. However, to deploy it in a Production scenario you will typically need to do some configuration to make it work. This article details the steps necessary to deploy an Angular Router application anywhere on Internet Information Services (IIS).
import { LocationStrategy, PathLocationStrategy } from '@angular/common'; Now execute ng build --prod once more and upload the new distribution files to your shared server — everything should now work! That is all you need to begin working with Angular on your very own shared hosting server.
The url change is handled by webpack. This is controlled by the --deploy-url.
Running the following fixes it:
ng build --base-href "/Web" --deploy-url "/Web/"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With