HTTP Error 403.14 in ASP.NET5 MVC6

1.6k views Asked by At

I am just exploring ASP.NET 5 MVC 6 web app with new Visual Studio Community 2015 RC. DotNet framework 4.6.

I've added reference Microsoft.AspNet.MVC (6.0.0-beta4) from nuget. Then created Models,Views & Controllers directory. Also added HomeController and a view.

Here is my Startup.cs-

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvc();
    }

    public void Configure(IApplicationBuilder app)
    {
          app.UseMvc();
    }
}

Home Conctoller-

public class HomeController : Controller
{
    public IActionResult Index()
    {
        return View();
    }
}

But while i try to run the project, browser shows

HTTP Error 403.14

A default document is not configured for the requested URL.

Do I need to do anything to configure?

1

There are 1 answers

1
Code It On BEST ANSWER

Try-

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvc();
    }

    public void Configure(IApplicationBuilder app)
    {
        app.UseMvc(routes =>
        {
            routes.MapRoute(
                name: "default",
                template: "{controller}/{action}/{id?}",
                defaults: new { controller = "Home", action = "Index" });
        });
    }

}