s.k.paul
s.k.paul

Reputation: 7291

HTTP Error 403.14 in ASP.NET5 MVC6

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?

Upvotes: 3

Views: 1578

Answers (1)

Code It
Code It

Reputation: 396

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" });
        });
    }

}

Upvotes: 3

Related Questions