Mashruwala Dhruvin
Mashruwala Dhruvin

Reputation: 61

How to resolve configuration error generated by IIS?

I am deploying my angular application on IIS manager. I build my application using this command ng build --prod --base-href /home/ And data generated on dist folder, I added that folder on IIS application. This is the files generated on dist folder

enter image description here

But while calling this endpoint, I am getting this error

enter image description here

What changes should I make to deploy my angular application on IIS?

Upvotes: 1

Views: 1074

Answers (1)

Motscha
Motscha

Reputation: 142

It seems the problem is a mismatch between your --base-href and the actual location of the Angular App.

The Path you provide must be the Path from your root folder to your Angular Application, or to be more precise, the Path from your root folder to your index.html and subsequently to all other Files needed.

Imagine the following: If your root folder is /var/www/public_html or C:\inetpub\wwwroot and you place your Angular app there, then your --base-href is just a single /.

If you place your Angular App in /var/www/public_html/home or C:\inetpub\wwwroot\home than your --base-href is just a single /home.

If you place your dist Folder in there your Path would be /var/www/public_html/home/dist or C:\inetpub\wwwroot\home\dist and therefore the --base-href must be --base-href /home/dist.

It all depends where your Root folder and your Angular App is located on your Filesystem.

Depending on this Configuration, the Angular App will be available at http://my-domain.tld + <baseHref>. So either http://my-domain.tld/ or http://my-domain.tld/home

What is the Root Folder?

The Root Folder is the folder, where all the files are you get served if you browse to http://my-domain.tld

Upvotes: 2

Related Questions