Reputation: 29
I have an Angular 7 application I am hosting on IIS 7, which should be accessible at https://example.com/fitcbooks/web. This was working, then suddenly stopped - for reason I can't seem to understand. The URL Rewrite on the server seems to be working (used to redirect other sites on same server) but it just breaks down for this particular app.
I HAVE ALREADY INSTALLED URL REWRITE MODULE 2 for IIS7. I also built the angular application using --base-ref and already used the web.config code as shown below. I have also built a local version of the app and it works perfectly on my macbook running AMPPS, eliminating any issues in the app itself. This looks like a server problem.
web.config:
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Angular Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/fitcbooks/web/index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
index.html:
<base href="/fitcbooks/web/">
Currently the app's preloader just loads forever. The console shows several 500 (URL Rewrite Module Error.) errors. Please kindly help.
Upvotes: 2
Views: 2474
Reputation: 29
Finally solved this!
The problem was the automatic encryption of files zip-compressed on mac. I just switched from Windows to Mac because of iOS development last week, so I'm new to this.
I was able to figure this out by reading the details of the 500 HTTP error using Failed Request Tracing Rules in IIS (thanks to @LexLi for the Fiddler tip). I observed the logs and discovered that the specific Error was 500:50. Also found ErrorCode Access is denied. (0x80070005)
, which made me realize it had something to do with access to the file. After some online digging, I found this forum post (https://forums.iis.net/t/1164360.aspx), installed Process Monitor and saw that clearly, the Server couldn't access the app's files.
The folders in the app had green labels, so I realized they were encrypted. I re-uploaded the files without encrypting and that was it - the app was working! So I learned the hard way that files compressed on a mac might give you problems on windows.
Just putting this out here in case it helps someone else.
Upvotes: 1