【发布时间】:2016-08-30 21:32:40
【问题描述】:
我有一个使用 Visual Studio 2015 开发的 AngularJS SPA 应用程序。当我单击发布时,它会发布 index.html 并且工作正常。但是,如果我在一个页面上并单击刷新,那么它会尝试刷新 SPA 页面,例如 example.com/home/about。这失败了,因为我没有主页/关于页面。
有什么方法可以修改我的 web.config 文件(仅用于本地测试),以便它实际上进入 index.html(加载它),然后进入 /home/about 状态?
这是我当前的 web.config:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration>
【问题讨论】:
-
您需要在您的网络配置上设置 URL 重写规则
-
这就是你要找的东西吗:stackoverflow.com/questions/12614072/…