而不必键入index.html的默认angularjs页

问题描述 投票:0回答:1

我创建与2017年VS社区的angularjs应用。当我在本地运行应用程序,我得到了localhost通过在地址栏中输入端口,但它并不需要我在默认情况下的index.html。如果我那么index.html键入它的工作原理,但由于所有路由经过该index.html中迷上了角应用该遗址的路由。因为它那么不经过index.html中定义的angularjs应用端口号/ my_other_route_here:我不能键入localhost。我如何获得IISExpress这样做自动路由,而无需键入Index.html到的index.html?

我在我的配置文件下面并认为这将与帮助,并在过去所以不知道这一次有什么不同。

<!-- Must have this so that direct entries in the browsers address bar get routed correctly. This routes entires that don't have physical paths to index.htm which
    will route it correctly if a path is setup. Basically this allows for pretty url's like localhost:1234/red -->
    <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>
    <!-- END rules -->
angularjs visual-studio-2017
1个回答
0
投票

所以我用于Web API(不MVC)的默认ASP.NET应用程序模板,但它无论如何增加了MVC。它有一个的RegisterRoutes()这是在做一些测绘的事实似乎是为什么这发生。当我在这里注释掉一切(大概可以删除整个文件),那么在默认情况下它会打开index.html,而不必把它在地址栏中。

© www.soinside.com 2019 - 2024. All rights reserved.