In my Asp.net core 3 project I am using some controler to access from js code to do some stuff and also using Razor pages at the same time.
at the configure service section :
services.AddControllersWithViews();
services.AddRazorPages();
I added both RazorPages and MVC controller with view.
And at then configure section
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapRazorPages();
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
Added above codes.
When I try to access to controller I am getting 404. I also tried to add just services.AddControllers();
need help please.
Edit : controller code
public class DashboardsController : BaseController, IDashboardsController
{
[HttpGet]
public async Task<JsonResult> GetAssetCategorySummaryAsync(){
-------
}
}
app.UseEndpoints(endpoints => { endpoints.MapControllers(); endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); endpoints.MapRazorPages(); });