简体   繁体   English

在将新视图页面MVC 5发布到IIS 8.5时接收错误页面,可以在本地调试良好

[英]Receiving error page when publishing new view pages MVC 5 to IIS 8.5 , works fine debugging on local

Server Error in '' Application. ''应用程序中的服务器错误。 After turning off customErrors. 关闭customErrors之后。 Receiving the below on two new view pages, i created the views, they work fine when debugging on my local. 在两个新的视图页面上收到以下内容后,我创建了视图,在本地调试时它们可以正常工作。 The views are cshtml, from iEnumerable models, returning a toList() using currentURL Request.URL.AbsoluteURi in the view which might be the problem? 视图是来自iEnumerable模型的cshtml,使用视图中的currentURL Request.URL.AbsoluteURi返回toList()可能是问题所在? I've denied annonymous authentication, enabled windows auth. 我已拒绝匿名身份验证,已启用Windows身份验证。

There is already an open DataReader associated with this Command which must be closed first.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first.]
   System.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand command) +2076283
   System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async) +328
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +130
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +98
   System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +202
   System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch(TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed) +104
   System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext) +505
   System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +37

[EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details.]
   System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +126
   System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute(ObjectContext context, ObjectParameterCollection parameterValues) +1047
   System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction(Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess) +469
   System.Data.Entity.Core.Objects.<>c__DisplayClass7.<GetResults>b__5() +205
   System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Func`1 operation) +238
   System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +349
   System.Data.Entity.Core.Objects.DataClasses.EntityReference`1.Load(MergeOption mergeOption) +188
   System.Data.Entity.Core.Objects.DataClasses.RelatedEnd.DeferredLoad() +449
   System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.LoadProperty(TItem propertyValue, String relationshipName, String targetRoleName, Boolean mustBeNull, Object wrapperObject) +131
   System.Data.Entity.Core.Objects.Internal.<>c__DisplayClass7`2.<GetInterceptorDelegate>b__2(TProxy proxy, TItem item) +151
   System.Data.Entity.DynamicProxies.Milestone_A196562B8A8F9C6DAB6533FEB9BCA439C46C7CA6A6A60E91A85439617B2A923F.get_Initiative() +39
   WAD_MP.Controllers.MilestonesController.List(Nullable`1 id) +979
   lambda_method(Closure , ControllerBase , Object[] ) +145
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +209
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
   System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39
   System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +67
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +72
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +386
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +30
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +186
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +36
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +44
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +399
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137

Solved by changing the if statement query to ToList() 通过将if语句查询更改为ToList()来解决

rather than just converting toList at end of controller, i had to make sure the if statements were using toList() as well 而不是仅在控制器末尾转换toList,我必须确保if语句也使用toList()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 IIS 8.5上的MVC 5错误 - MVC 5 on IIS 8.5 error Mvc4网站在本地可以正常运行,但是在部署后在IIS Server 8.5上显示错误 - Mvc4 website locally working fine but gives error on IIS Server 8.5 after deployment 在MVC中发布到IIS时显示自定义html页面 - Display a custom html page when publishing to IIS in MVC MVC应用程序中的$ .get()和$ .post()在本地Cassini网络服务器中可以正常工作,但是当发布到IIS 7.5中后,它将不再起作用 - $.get() and $.post() in MVC app works fine in local Cassini webserver but when published into IIS 7.5 it doesn't work anymore 当将MVC 3应用程序部署到IIS 7时,索引页可以很好地加载,但是当我选择菜单项404 Error Pops时 - When Deploying MVC 3 Application to IIS 7 The index pages load fine but when I select Menu item 404 Error Pops 如何在IIS 8.5中发布时修复此错误 - how to fix this error when published in IIS 8.5 在本地 IIS 上运行时调试给出 404 错误 - Debugging give 404 error when running on local IIS WebApplication 在 IIS Express 上运行良好,但在本地 IIS 上不起作用 - WebApplication works fine on IIS Express but it doesn't on Local IIS IIS 8.5上托管的404错误ASP.NET MVC应用程序 - 404 error ASP.NET MVC application hosted on IIS 8.5 ASP NET MVC5编译器在IIS中发布错误(在VS2015中工作正常) - ASP NET MVC5 compiler publish error in IIS (works fine in VS2015)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM