How to deploy angular-cli app on iis

后端 未结 10 1802
别那么骄傲
别那么骄傲 2020-12-23 02:17

I have simple angular2-cli app (one page with model driven form - no router involved). With \"ng serve\" all works fine. I made production version with ng build --product. I

10条回答
  •  感情败类
    2020-12-23 02:59

    Here is how I solve this situation;

    • Create project with angular-cli
    • Build your application with ng build
    • Open IIS, create new virtual directory and show dist folder
    • Set base href in your index.html from / to /yourAliasNameOnIIS
    • Use this web.config for redirecting requests to your index.html page

      
      
        
          
            
            
              
              
              
            
            
          
        
      
      

    • Convert your virtual directory to a web application

    You can also use ng build --deploy-url "/yourAliasNameOnIIS" to change src path in dist/index.html.

    I hope it helps!

提交回复
热议问题