Mandar Shinde

Mandar Shinde

  • NA
  • 423
  • 114.7k

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>  
  3.   
  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>  
  18.   
  19. </configuration>  
How can I overcome on above problem.
Please let me any easy solution. 
Thanking you in advanced,
Regards.

Answers (2)