HTTP error 403.14 in ASP.NET5 MVC6
I am just learning ASP.NET 5 MVC 6 web application with new Visual Studio Community 2015 RC. DotNet framework 4.6.
I have added a link Microsoft.AspNet.MVC (6.0.0-beta4) from nuget. Then create a catalog of models, views and controllers. Also added HomeController and 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 am trying to run the project, the browser shows
HTTP Error 403.14
The default document is not configured for the requested URL.
Do I need to do anything to set it up?
+3
source to share
1 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" });
});
}
}
+3
source to share