我正在使用React-Router构建SPA应用程序来处理前端路由.
我正在尝试配置ASP.NET 5 Startup.cs文件以使用MVC,但是当路由与我的任何API路由都不匹配时,发送index.html文件以便它能够处理react-routers浏览器历史记录作为执行陈述这里.
到目前为止,我只能在默认路由上发送index.html文件,即在localhost:3000之后没有发送.
到目前为止我的启动配置方法.谢谢
app.UseIdentity();
app.UseIISPlatformHandler();
app.UseDefaultFiles(new DefaultFilesOptions {
DefaultFileNames = new List<string> { "index.html"}
});
app.UseStaticFiles();
app.UseMvc();
Run Code Online (Sandbox Code Playgroud)