asp.net mvc - How to set up an IIS Rewrite rule for everything except the /api route -
i'm setting webapi application angular front-end. want enable html5mode, web server needs have re-write rule sends requests index page.
the problem actions in /api route matching rule of course, none of rest calls pass through rewrite rule.
i'm sure i'm not alone problem. can share section of web.config rest service works , html5mode isn't broken?
<system.webserver> <modules> <remove name="formsauthentication" /> </modules> <handlers> <remove name="extensionlessurlhandler-integrated-4.0" /> <remove name="optionsverbhandler" /> <remove name="traceverbhandler" /> <add name="extensionlessurlhandler-integrated-4.0" path="*." verb="*" type="system.web.handlers.transferrequesthandler" precondition="integratedmode,runtimeversionv4.0" /> </handlers> <rewrite> <rules> <rule name="main rule" stopprocessing="true"> <match url=".*" /> <conditions logicalgrouping="matchall"> <add input="{request_filename}" matchtype="isfile" negate="true" /> <add input="{request_filename}" matchtype="isdirectory" negate="true" /> <add input="{request_uri}" matchtype="pattern" pattern="api/(.*)" negate="true" /> </conditions> <action type="rewrite" url="/" /> </rule> </rules> </rewrite> </system.webserver>
Comments
Post a Comment