Mandar Shinde

Mandar Shinde

  • 1.6k
  • 365
  • 31.6k

Regarding refresh won't work after deployment

Jun 12 2019 4:38 AM
Dear All,
I have build one small project using Angular 6 and ASP .Net MVC 5 with Rest Api and deployed on IIS.
I am not able to refresh my web pages, if I do that then I am getting error of 404.
To overcome on this problem I get come to kow that I should use URL rewrite and web.config.
If I use following web.config with Angular 6 prod files then I can  able to refresh to all pages but it produces another error i.e. related to CORS.
Here is follwing my web.config :-
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <configuration>  
  4. <system.webServer>  
  5.   <rewrite>  
  6.     <rules>  
  7.       <rule name="Angular Routes" stopProcessing="true">  
  8.         <match url=".*" />  
  9.         <conditions logicalGrouping="MatchAll">  
  10.           <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />  
  11.           <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />  
  12.         </conditions>  
  13.         <action type="Rewrite" url="./index.html" />  
  14.       </rule>  
  15.     </rules>  
  16.   </rewrite>  
  17. </system.webServer>  
  19. </configuration>  
How can I overcome on above problem.
Please let me any easy solution. 
Thanking you in advanced,

Brought to you by: JavaScript SDK for Bold BI dashboard and analytics embedding. Free trial.

Answers (2)