Somewhat related to this other posting I have. Due to that issue, I am basically doing a copy/paste of one of my existing (working ) controllers to create a new controller. So far I have created three new controllers, country, state and address, using the copy/paste method. Two of them are working just fine without any issues.
The third controller address, just keeps returning 404 error pages whenever one of my other pages/controllers tries to launch any method in the "Address" controller. My index method in this controller currently just displays a very simple index page with just a heading and one line of text content. Even this wont open up.
I then created a copy of the address controller named it "test". Then added just an index method, with a very basic index view with no content, just a heading and one line of text. I added this test controller to the left navigation menu as a new entry and tried to open the index page from there, still it does not work. I keep getting 404 errors!
Here is a snippet from the AspNetZero log file, showing the 404 error.
INFO 2018-08-06 14:28:17,619 [37 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action EXLNT.NursingOps17.NursingOps.StateAppService.GetStates (EXLNT.NursingOps17.Application) in 42.5497ms INFO 2018-08-06 14:28:17,619 [37 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 51.7445ms 200 application/json; charset=utf-8 INFO 2018-08-06 14:29:01,372 [3 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost:62114/Nursing/Address
INFO 2018-08-06 14:29:01,376 [3 ] tion.Cookies.CookieAuthenticationHandler - AuthenticationScheme: Identity.Application was successfully authenticated. INFO 2018-08-06 14:29:01,376 [3 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 3.6013ms 404
Here is my controller code:
using Abp.AspNetCore.Mvc.Authorization;
using Microsoft.AspNetCore.Mvc;
using EXLNT.NursingOps17.Authorization;
using EXLNT.NursingOps17.Web.Controllers;
using Abp.Auditing;
using EXLNT.NursingOps17.NursingOps.AppServices;
using EXLNT.NursingOps17.NursingOps;
using System.Threading.Tasks;
using Abp.Application.Services.Dto;
using Microsoft.AspNetCore.Mvc.Rendering;
using EXLNT.NursingOps17.Web.Areas.Nursing.Models.Address;
using System.Collections.Generic;
using EXLNT.NursingOps17.Core.NursingOps;
namespace EXLNT.NursingOps17.Web.Areas.Nursing.Controllers
{
public class AddressController : NursingOps17ControllerBase
{
private readonly IListValuesAppService _listValuesAppService;
private readonly IAddressAppService _addressAppService;
private readonly ICountryAppService _countryAppService;
private readonly IStateAppService _statesAppService;
public AddressController(IAddressAppService addressAppService,
IListValuesAppService listValuesAppService,
ICountryAppService countryAppService,
IStateAppService StatesAppService)
{
_addressAppService = addressAppService;
_listValuesAppService = listValuesAppService;
_countryAppService = countryAppService;
_statesAppService = StatesAppService;
}
public ActionResult Index()
{
return View();
}
public PartialViewResult CreateModal()
{
//Code removed for brevity
return PartialView("_CreateModal", viewModel);
}
//Edit
public async Task<PartialViewResult> EditModal(int id)
{
//Code removed for brevity
return PartialView("_EditModal", viewModel);
}
}
}
I have compared everything in this controller to all my other working controllers and I cannot see what I am missing that could be causing this issue?
The controller was not decorated with "Area" attribute. Always the most simple things that trip me up!