All of my controller actions are rendering fine except for one.
I have found other solutions that pertain to IIS express, however this is running on server 2012.
Here is the controller action:
public ActionResult Index()
{
try
{
var viewModels = GetHostInfoViewModelList();
return View(viewModels);
}
catch (Exception ex)
{
ex.ReportError();
return new HttpStatusCodeResult(404,$"{ex.Message}|{ex.InnerException}");
}
}
Here is GetHostInfoViewModelList:
public IEnumerable<ViewModelHostInfo> GetHostInfoViewModelList()
{
using (var db = new WINCMUEntities())
{
try
{
//join host info with sleep status
var sleepRecords = db.SleepTrackings.ToList();
var hostInfo = db.WINCMU_HostInfo.ToList();
var viewModels = new List<ViewModelHostInfo>();
hostInfo.ForEach(x =>
{
viewModels.Add(new ViewModelHostInfo()
{
HostName = x.HostName ?? "Not Found",
Id = x.ID,
newsystem = x.newsystem,
Zone = x.Zone ?? "Not Found",
IsSleeping = sleepRecords.FirstOrDefault(s => s.HostName.ToLower() == x.HostName.ToLower())
?.IsCurrentlySleeping ?? false,
IP_address = x.IP_address ?? "Not Found",
ReportingArea = x.ReportingArea ?? "Not Found",
agent_active = x.agent_active,
date_added = x.date_added,
is_agent = x.is_agent
});
});
return viewModels;
}
catch (Exception ex)
{
ex.ReportError();
throw;
//return new List<ViewModelHostInfo>();
}
}
}
Here is the complete error text:
[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: value]
System.Web.HttpResponse.set_StatusDescription(String value) +4538824
System.Web.Mvc.HttpStatusCodeResult.ExecuteResult(ControllerContext context) +109
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +88
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList
1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +775
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult) +81
System.Web.Mvc.Async.<>c__DisplayClass3_1.<BeginInvokeAction>b__5(IAsyncResult asyncResult) +188
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
System.Web.Mvc.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +26
System.Web.Mvc.Async.WrappedAsyncVoid
1.CallEndDelegate(IAsyncResult asyncResult) +68
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52
System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +39
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
System.Web.Mvc.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +40
System.Web.Mvc.Async.WrappedAsyncVoid
1.CallEndDelegate(IAsyncResult asyncResult) +68
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +602
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +128
GetHostInfoViewModelList()
? Your problem might be there – Rui Jarimba