AspNetZero - 新控制器不断重新调整 404
AspNetZero - New controller keeps retuning 404
有点related to this other posting我有。由于这个问题,我基本上是在 copy/paste 我现有的(工作
) 控制器来创建一个新的控制器。
到目前为止,我已经使用 copy/paste 方法创建了三个新控制器,country、state 和 address。其中两个工作正常,没有任何问题。
第三个控制器地址,只要我的另一个 pages/controllers 试图启动 "Address" 控制器中的任何方法,就会不断返回 404 错误页面。我在这个控制器中的索引方法目前只显示一个非常简单的索引页面,只有一个标题和一行文本内容。连这个都打不开
然后我创建了一个名为 "test" 的地址控制器的副本。然后只添加一个索引方法,有一个非常基本的索引视图,没有内容,只有一个标题和一行文本。
我将此测试控制器作为新条目添加到左侧导航菜单,并尝试从那里打开索引页面,但仍然无法正常工作。我一直收到 404 错误!
这是 AspNetZero 日志文件的片段,显示了 404 错误。
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
这是我的控制器代码:
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);
}
}
}
我已经将此控制器中的所有内容与我所有其他工作中的控制器进行了比较,但我看不出我遗漏了什么可能导致此问题?
控制器未使用 "Area" 属性修饰。总是最简单的事情让我失望!
有点related to this other posting我有。由于这个问题,我基本上是在 copy/paste 我现有的(工作 ) 控制器来创建一个新的控制器。 到目前为止,我已经使用 copy/paste 方法创建了三个新控制器,country、state 和 address。其中两个工作正常,没有任何问题。
第三个控制器地址,只要我的另一个 pages/controllers 试图启动 "Address" 控制器中的任何方法,就会不断返回 404 错误页面。我在这个控制器中的索引方法目前只显示一个非常简单的索引页面,只有一个标题和一行文本内容。连这个都打不开
然后我创建了一个名为 "test" 的地址控制器的副本。然后只添加一个索引方法,有一个非常基本的索引视图,没有内容,只有一个标题和一行文本。 我将此测试控制器作为新条目添加到左侧导航菜单,并尝试从那里打开索引页面,但仍然无法正常工作。我一直收到 404 错误!
这是 AspNetZero 日志文件的片段,显示了 404 错误。
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
这是我的控制器代码:
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);
}
}
}
我已经将此控制器中的所有内容与我所有其他工作中的控制器进行了比较,但我看不出我遗漏了什么可能导致此问题?
控制器未使用 "Area" 属性修饰。总是最简单的事情让我失望!