配置IIS服务器以使用Aurelia框架和推送状态

Lau*_*ate 11 asp.net pushstate asp.net-web-api aurelia aurelia-router

我从这个repo开始创建了一个基本的aurelia应用程序,我试图摆脱URL栏中的#(hashtag).

我有2个项目,一个在一台机器上运行WebApi,另一个在另一台机器上运行一个空的Web项目(不是MVC).在官方文档网站上,它只说明了如何配置你的路线,但我的项目不是面向MVC的.

如何从Web.config配置IIS服务器,因为当我访问http://localhost/home它时应该启动aurelia框架而不是404未找到的页面?

Mat*_*abe 16

我正在使用需要web.config来正确处理非散列路由的Azure,它只是将所有路由重定向到包含aurelia应用程序的index.html.没有它(或类似的技术)它给404s.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.webServer>
     <rewrite>
             <rules>
                 <remove name="redirect all requests" />
                 <rule name="redirect all requests" stopProcessing="true">
                     <match url="^(.*)$" ignoreCase="false" />
                     <conditions logicalGrouping="MatchAll">
                         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
                     </conditions>
                     <action type="Rewrite" url="index.html" appendQueryString="true" />
                 </rule>
             </rules>
         </rewrite>
    </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助.