配置 IIS 服务器以使用 Aurelia 框架和推送状态
Configure IIS server to work with Aurelia framework and push state
我从 this repo 开始创建了一个基本的 aurelia 应用程序,我试图摆脱 URL 栏中的 #(井号标签)。
我有 2 个项目,一个 运行 WebApi 在一台机器上,一个 运行 一个在另一台机器上的空 Web 项目(不是 MVC)。在 official documentation website 上它只说明了如何配置你的路由,但我的项目不是面向 MVC 的。
我如何从 Web.config 配置 IIS 服务器,在某种意义上,当我访问 http://localhost/home
时,它应该启动 aurelia 框架而不是 404 未找到页面?
我正在使用需要 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>
希望对您有所帮助。
我从 this repo 开始创建了一个基本的 aurelia 应用程序,我试图摆脱 URL 栏中的 #(井号标签)。
我有 2 个项目,一个 运行 WebApi 在一台机器上,一个 运行 一个在另一台机器上的空 Web 项目(不是 MVC)。在 official documentation website 上它只说明了如何配置你的路由,但我的项目不是面向 MVC 的。
我如何从 Web.config 配置 IIS 服务器,在某种意义上,当我访问 http://localhost/home
时,它应该启动 aurelia 框架而不是 404 未找到页面?
我正在使用需要 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>
希望对您有所帮助。