[英].NET Core with Angular : How do I configure IIS for URL Rewriting in HTML5 mode?
I have built an angular 6 application with .Net core 2.1 and deployed to azure server on IIS web server. 我已经使用.Net core 2.1构建了一个angular 6应用程序,并将其部署到IIS Web服务器上的azure服务器。 The routing is working fine on localhost when refresh, but not working on azure server.
刷新时,路由在本地主机上工作正常,但在azure服务器上不工作。 I checked angular deployment guideline and added following code in web.config file
我检查了角度部署准则,并在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>
Now, I got into new problem. 现在,我遇到了新问题。 All the files now contains
index.html
content, instead of their respective file content. 现在,所有文件都包含
index.html
内容,而不是它们各自的文件内容。
What am I missing here? 我在这里想念什么? Do I need to make any changes to kestrel server
我是否需要对Kestrel服务器进行任何更改
This section of the angular guide does not apply to ASP.NET Core hosted Angular applications. 角度指南的本部分不适用于ASP.NET Core托管的Angular应用程序。 Only for non-.NET or classic ASP.NET websites, a rewrite module definition is needed.
仅对于非.NET或经典ASP.NET网站,才需要重写模块定义。
If you started your application based on ASP.NET Core's templates for angular or SPAs, you have rewriting / SPA fallback routes set up already. 如果您基于针对角度或SPA的ASP.NET Core的模板启动应用程序,则您已经设置了重写/ SPA后备路由。
I suggest starting from applications created with dotnet new angular -o MyAngularApp
our using VS' angular templates (both use the same template packages). 我建议从使用
dotnet new angular -o MyAngularApp
创建dotnet new angular -o MyAngularApp
应用程序开始,我们使用VS'的角度模板(两者都使用相同的模板包)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.