I've been struggling with deploying WebApi and angular applications into IIS for days now, This is my first time deploying apps into IIS and on publish domain, so forgive any obvious mistakes below.
My question is, what is the best approach for deploying Angular and Web api on IIS, and how to do it?
If you got a link explaining the process I can relay on, would be much appreciated.
I tried two methods in deploying the application:
Adding two separate sites on iis:
1.1. web api with host name 'localhost'
1.2. angular with host name 'mydomain.com' and set the base angular url to 'localhost'
- the idea is hosting the angular publicly and calling the web api locally.
- Each site is working fine alone but couldn't manage to make the angular site call the api successfully.
Second method is adding site for angular and then adding application for web api under it.
Neither of these two approaches are working.
done for both approaches:
- Installing .net core hosting bundle
- Installing URL Rewrite
- ASP.NET Core Runtime
- Applying what in this answer to use Out of process hosting model
- I will switch to use in process once everything is working correctly.
- Adding web.config to angular application to add rewrite rule from here (angular documentation iis)
- Application pool .NET CLR Version set to no managed code