我的角度項目位於app
文件夾中,因此,我指的是我必須寫入http://localhost:45485/app
,但我想從此URL中刪除app
。我試圖這樣做,但它不起作用。我不知道該怎麼做,請幫助我。更改根路徑ASP WebApi
web.config文件:
<rewrite>
<rules>
<clear/>
<rule name="app" stopProcessing="true">
<match url="^(.+)$" />
<conditions>
<add input="{APPL_PHYSICAL_PATH}app\{R:1}" matchType="IsFile" />
</conditions>
<action type="Rewrite" url="/app/{R:1}" />
</rule>
<rule name="index.html as document root" stopProcessing="true">
<match url="^$" />
<action type="Rewrite" url="/app/index.html" />
</rule>
</rules>
</rewrite>
在結果,我有這樣的問題:
雖然我感興趣的是如何做到這一點(正確),對「爲什麼」好奇?對於「web api」應用程序?如果這是一個前端角度項目(僅),那麼它似乎是「方圓孔中的圓釘」。...... – EdSF
@EdSF,我只是研究它,並不明白一些時刻,但爲什麼不呢?在我看來,這是真的,所以我想嘗試。 – Lightness