[英].NET Core with Angular : How do I configure IIS for URL Rewriting in HTML5 mode?
我已經使用.Net core 2.1構建了一個angular 6應用程序,並將其部署到IIS Web服務器上的azure服務器。 刷新時,路由在本地主機上工作正常,但在azure服務器上不工作。 我檢查了角度部署准則,並在web.config文件中添加了以下代碼
<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>
現在,我遇到了新問題。 現在,所有文件都包含index.html
內容,而不是它們各自的文件內容。
我在這里想念什么? 我是否需要對Kestrel服務器進行任何更改
角度指南的本部分不適用於ASP.NET Core托管的Angular應用程序。 僅對於非.NET或經典ASP.NET網站,才需要重寫模塊定義。
如果您基於針對角度或SPA的ASP.NET Core的模板啟動應用程序,則您已經設置了重寫/ SPA后備路由。
我建議從使用dotnet new angular -o MyAngularApp
創建dotnet new angular -o MyAngularApp
應用程序開始,我們使用VS'的角度模板(兩者都使用相同的模板包)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.