我知道过去曾多次询问过这个问题,但对我来说什么也没做。这是我的控制器方法,因为我得到错误。
public PartialViewResult _CalendarDisplaySystem(AppointmentsViewModel appointmentsViewModel, Int32 pgNm, Int32 pgSz, Int32 sortCondition, string sortDirection, string GlobalSubmitVar, bool? chkIsCompleted,bool? chkIsBillPaid, string selectedVisitDate, string searchByVisitType, string searchByLocation, string searchByProvider)
{
IList<Appointments> obj = null;
if (appointmentsViewModel == null)
{
appointmentsViewModel = new AppointmentsViewModel();
}
try
{
bool bIsCompleted = chkIsCompleted.HasValue ? chkIsCompleted.Value : false;
bool bIsBillPaid = chkIsBillPaid.HasValue ? chkIsBillPaid.Value : false;
if (searchByVisitType == "" && searchByLocation == "" && searchByProvider == "")
{
return PartialView(appointmentsViewModel);
}
else
{
if (GlobalSubmitVar == "1")
{
IList<Locations> locations = null;
locations = LocationsBo.LoadAll().ToList().OrderBy(x => x.Name).ToList();
string locationsText = string.Empty;
if (locations.Count() > 0)
{
for (int icount = 0; icount < locations.Count(); icount++)
{
locationsText += locations[icount].Name + ";";
}
}
searchByLocation = locationsText.ToString();
IList<VisitType> visitType = null;
visitType = VisitTypeBo.LoadAll().ToList().OrderBy(x => x.VisitTypeName).ToList();
string visitTypeText = string.Empty;
if (visitType.Count() > 0)
{
for (int icount = 0; icount < visitType.Count(); icount++)
{
visitTypeText += visitType[icount].VisitTypeName + ";";
}
}
searchByVisitType = visitTypeText.ToString();
IList<Provider> Provider = null;
Provider = ProviderBo.LoadAll().ToList().OrderBy(x => x.ProvName).ToList();
string ProviderText = string.Empty;
if (Provider.Count() > 0)
{
for (int icount = 0; icount < Provider.Count(); icount++)
{
ProviderText += Provider[icount].ProvName + ";";
}
}
searchByProvider = ProviderText.ToString();
}
obj = AppointmentsBo.LoadAllAppointments(pgNm, pgSz, sortCondition, sortDirection, bIsCompleted,bIsBillPaid, Convert.ToDateTime(selectedVisitDate), Convert.ToInt32(Enums.AppointmentCalendarStatus.Seen), searchByVisitType, searchByLocation, searchByProvider).ToList();
// Convert the 24 hours time to 12 hours time with AM/PM
for (int i = 0; i < obj.Count; i++)
{
int hour = Convert.ToInt16(obj[i].StartTime.Split(':')[0]);
int min = Convert.ToInt16(obj[i].StartTime.Split(':')[1]);
obj[i].StartTime = (Convert.ToDateTime(DateTime.Now.ToShortDateString() + " " + hour + ":" + min)).ToString("hh:mm tt").ToUpper().Trim();
hour = Convert.ToInt16(obj[i].EndTime.Split(':')[0]);
min = Convert.ToInt16(obj[i].EndTime.Split(':')[1]);
obj[i].EndTime = (Convert.ToDateTime(DateTime.Now.ToShortDateString() + " " + hour + ":" + min)).ToString("hh:mm tt").ToUpper().Trim();
}
appointmentsViewModel.AppointmentModel = obj.ToList();
//return PartialView(appointmentsViewModel);
}
}
catch (Exception e)
{
Content(e.Message.ToString());
}
return PartialView(appointmentsViewModel);
}
这里的问题是,当我在本地运行应用程序时,它不会抛出任何异常,但是当我想通过IIS打开时我会得到异常,有人可以告诉我可能是什么问题。
这里是Stack-Trace
异常:类型&#39; System.StackOverflowException&#39;的未处理异常发生在Data.dll
中Exception information:
Exception type: InvalidOperationException
Exception message: The partial view '_CalendarDisplaySystem' was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/CalendarDisplaySystem/_CalendarDisplaySystem.aspx
~/Views/CalendarDisplaySystem/_CalendarDisplaySystem.ascx
~/Views/Shared/_CalendarDisplaySystem.aspx
~/Views/Shared/_CalendarDisplaySystem.ascx
~/Views/CalendarDisplaySystem/_CalendarDisplaySystem.cshtml
~/Views/CalendarDisplaySystem/_CalendarDisplaySystem.vbhtml
~/Views/Shared/_CalendarDisplaySystem.cshtml
~/Views/Shared/_CalendarDisplaySystem.vbhtml
at System.Web.Mvc.PartialViewResult.FindView(ControllerContext context)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
at System.Web.Mvc.Controller.ExecuteCore()
at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext)
at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__5()
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
at System.Web.Mvc.MvcHandler.<>c__DisplayClasse.<EndProcessRequest>b__d()
at System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f)
at System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action)
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)