使用 Angular ui 路由 html5Mode 的 IIS 配置 [英] IIS configuration for using angular ui routing html5Mode

查看:17
本文介绍了使用 Angular ui 路由 html5Mode 的 IIS 配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 angular ui-routing 但出于最常遇到的问题原因,我想问一些问题.由于使用了#"标签,我更喜欢 html5Mode 属性.但是服务器端conf.需要.(https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions#how-to-configure-your-server-to-work-with-html5mode)我正在使用 IIS,我把:

Im using angular ui-routing but for the most encountered problem reason I want to ask something. Because of using '#' hashtag I prefered html5Mode property. But server side conf. is needed.(https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions#how-to-configure-your-server-to-work-with-html5mode) I m using IIS and I put the :

 <rewrite>
  <rules>
    <rule name="AngularJS Routes" stopProcessing="true">
      <match url=".*" />
      <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
      </conditions>
      <action type="Rewrite" url="/" />
    </rule>
  </rules>
</rewrite>

并安装一个在stackoverflow上提到的另一个主题的工具(我该怎么做配置 IIS 以在 HTML5 模式下重写 AngularJS 应用程序的 URL?).但现在我得到:HTTP 错误 403.18 - 禁止在 Web 服务器上为此资源配置的应用程序池中无法处理指定的请求.我真的把大部分时间都花在了标签问题上 :( 请帮帮我.缺少什么?

and install one tool which is mentioned another topic on stackoverflow (How do I configure IIS for URL Rewriting an AngularJS application in HTML5 mode?). But now I m getting : HTTP Error 403.18 - Forbidden The specified request cannot be processed in the application pool that is configured for this resource on the Web server.I m really spend my most of time for hashtag problem :( Please help me . What is the missing?

推荐答案

<match url=(.*)>
..
..
..
<action type="Rewrite" url="/{R:0}">

更改这两行并尝试,因为重写应该是向后资源兼容的

Change these two lines and try as the rewrite should be backward resource compatible

这篇关于使用 Angular ui 路由 html5Mode 的 IIS 配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆