TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Emanuele Leoni
NA
139
17k
ASP.NET Core route works only for Home Controller
Apr 20 2018 5:04 AM
I created a simple MVC .Net Core application with two controllers (Home and Recipes). When I debug it in windows os I can navigate /Home and /Recipes But when I run in linux I can navigate only /Home but not /Recipes. It returns 404.
This is my Startup.cs Configure:
using
(var serviceScope = app.ApplicationServices.GetService<IServiceScopeFactory>().CreateScope())
{
var context = serviceScope.ServiceProvider.GetRequiredService<DbContext>();
}
if
(env.IsDevelopment())
{
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler(
"/Home/Error"
);
}
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute( name:
"default"
, template:
"{controller=Home}/{action=Index}/{id?}"
);
});
I tried to call:
curl http://localhost:43124/Home/Index and It returns the html of the View curl http://localhost:43124/Recipes/Index and It returns nothing
What am I wrong?
Reply
Answers (
0
)
Error 404 after publish on IIS on in Asp.Net Core 2.0 App
Unable to cast object of type 'System.Web.UI.LiteralControl'