I'm trying to get index.cshtml to appear instead of index.html when I run my app, but index.html always appears

625 views Asked by At

This is my startup.cs file:

using System;using System.Collections.Generic;using System.Linq;using System.Threading.Tasks;using Microsoft.AspNetCore.Builder;using Microsoft.AspNetCore.Hosting;using Microsoft.AspNetCore.Http;using Microsoft.Extensions.DependencyInjection;using Microsoft.Extensions.Hosting;

namespace TigerTix3.Web{public class Startup{public void ConfigureServices(IServiceCollection services){services.AddControllersWithViews();}

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        //app.UseDefaultFiles();
        app.UseRouting();
        app.UseStaticFiles();

        app.UseEndpoints(endpoints =>
        {

            endpoints.MapControllerRoute("Default",
                "/{controller}/{action}/{id?}",
                new { controller = "App", action = "Index" });


        });
    }
}

}

Right now, the website is displaying "This Page isn't working" because I commented out app.UseDefaultFiles. When I un-comment that out, it displays index.html instead of index.cshtml. Any help would be greatly appreciated.

I am new to C#, HTML, and Visual Studio so I am going off of my instructors instructions, but it appears that the instructions don't work. I am positive I followed them to the letter.

0

There are 0 answers