Get Angular2 routing working on IIS 7.5

前端 未结 6 972
情深已故
情深已故 2020-12-05 17:37

I have been learning Angular2. The routing works just fine when running on the nodejs lite-server. I can go to the main (localhost:3000) page and move through the applicatio

6条回答
  •  囚心锁ツ
    2020-12-05 18:19

    (For angular 2, angular 4)

    Create a web.config file as in mentioned article.

    
      
        
          
            
              
              
                
                
              
              
            
          
        
      
    
    

    Place it in the root directory (same as index.html) of your site. Mine is in the dist folder (angular-cli project).

    After deploying, go to IIS if you have the access and you can click on the rewrite-rules icon and see that it read this config. If you do not see and icon for rewrite rules, you will need to enable the module under "modules" icon. This code snippet was not written by be but I wanted to share better implementation details.

提交回复
热议问题