I am installing an angular application on a hosting that consumes a rest api installed inside a directory on the same hosting. This app has the particularity that it needs to be accessed from a QR. The QR is going to have this information: https://www.example.com/example1 Suppose you go there and see the page of example 1. But as many already know, if you don't put a certain configuration inside the web.config we get a Error 404. (IIS Walkthrough)
So the web.config looks like this:
<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="./index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
And the error disappears being able to access the page of example1.
The problem is that now I get a 405 (Not allowed) when I try to access the api. In other words, requests like https://www.example.com/api/token give 405. This is surely configuration. I'm going to investigate on my own, in the meantime if someone solved it and gives me a hand. Cool!
The reason could be a conflict between WebDAV and the Web API application handler, you can try to remove WebDAV module from web.config to slove this issue.
<system.webServer>
<handlers>
<remove name="WebDAV">
</handlers>
<modules>
<remove name="WebDAVModule">
</modules>
</system.webServer>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.