【发布时间】:2015-08-18 22:11:26
【问题描述】:
在我的 angularjs 应用程序中,我使用 UI.Router 并尝试添加 html 5 模式以从 URL 中删除 #,我从 github 复制 ui 路由器的设置,有一个部分 Azure IIS Rewrites settings,这是设置
<system.webServer>
<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" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
即使页面刷新也一切正常,但它会中断我的 Web API 调用。
当我在 web api 上调用任何 get 方法时,它总是返回 index.html 内容。如果尝试调用任何 post 方法,它会给出错误:
HTTP 错误 405.0 - 方法不允许
您正在查找的页面无法显示,因为正在使用无效的方法(HTTP 动词)。
任何帮助解决它。
【问题讨论】:
标签: angularjs url-rewriting angular-ui-router asp.net-web-api