asp.net-mvc – 将index.html设置为默认页面

我有一个空的ASP.NET应用程序,我添加一个index.html文件。我想将index.html设置为网站的页面

我试图右键单击index.html并设置为起始页,当我运行它时,url是:http:// localhost:5134 / index.html但是我真正想要的是当我键入:http: // localhost:5134,它应该加载index.html页面

我的路由配置:

public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",url: "{controller}/{action}/{id}",defaults: new { controller = "Home",action = "Index",id = UrlParameter.Optional }
            );
        }
    }

解决方法

添加了一条指令给我的路由配置,以忽略空路由,这解决了我的问题。
routes.IgnoreRoute("");

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....