I am working on "Microsoft.AspNetCore.Mvc": "1.1.2"
My project folder structure is as below
Code in startup.cs is below
When I run my project I am not redirected to the index page. It shows 404 Error. Am I missing any setting?
I am working on "Microsoft.AspNetCore.Mvc": "1.1.2"
My project folder structure is as below
Code in startup.cs is below
When I run my project I am not redirected to the index page. It shows 404 Error. Am I missing any setting?
Your url should have this pattern (due to your routes configuration):
http://localhost:your_port_number/area_name
When you run your application your url pattern is:
http://localhost:your_port_number
There is no area name in the url.
You should specify the area Admin
in url, because you don't have default area and you get 404 Not Found
, so your url should be like this:
http://localhost:your_port_number/Admin
OR
You can set default value for Area
in app.UseMvc()
:
routes.MapRoute("adminRoute", "{area=Admin}/{controller=Admin}/{action=Index}/{id?}");
Now by default you call endpoint in area Admin
with controller name Admin
and action name Index
.