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:

  1. 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.
  2. 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:

  1. Installing .net core hosting bundle
  2. Installing URL Rewrite
  3. ASP.NET Core Runtime
  4. Applying what in this answer to use Out of process hosting model
    • I will switch to use in process once everything is working correctly.
  5. Adding web.config to angular application to add rewrite rule from here (angular documentation iis)
  6. Application pool .NET CLR Version set to no managed code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.