2017-04-11 52 views
0

我在單頁面應用程序中使用IIS中的重寫規則,並使用角度ui路由器爲我的項目提供服務,但是當我向api服務發送請求時,它不會調用它並重定向到我放入的頁面規則和響應的動作以HTML格式返回給我,這是返回給我的單頁面主體格式,而不是我想要使用該服務的預期數據。在ASP.NET中重寫規則

<rule name="HomeRule" stopProcessing="true"> 
    <match url="po" ignoreCase="true" /> 
     <conditions logicalGrouping="MatchAll"> 
     <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
     <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
     </conditions> 
     <action type="Rewrite" url="/Pages/MasterPage.html" /> 
    </rule> 

請任何一個可以幫助解決這個問題提前

+0

當你想要實現重寫URL時你需要提醒2件事1.你需要在你的IIS中安裝URL Rewrite 2.0和2.你應該在你的HTMl中添加你的'Basehref' – Webruster

+0

我真的要做這個步驟但我發送它的任何請求給我的HTML頁面的響應,並不返回我期望的數據,我希望從這個請求 –

+0

你能夠擊中api嗎? – Webruster

回答

0

感謝看看這是什麼話。

<conditions logicalGrouping="MatchAll"> 
     <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
     <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
</conditions> 

隨着MatchAll邏輯分組,它只是說執行規則如果文件名不是directory而不是filename。這是你真正想要的嗎?