微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

asp.net – System.InvalidOperationException:堆栈为空

一旦运行在Visual Studio 2013中构建的ASP.NET 4.x应用程序,我得到以下异常.

我已经尝试通过删除页面检查器程序集来禁用PageInspector

<assemblies>
    <remove assembly="Microsoft.VisualStudio.Web.PageInspector.Loader,Version=1.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"/>
</assemblies>

并将此配置添加到应用程序设置

<appSettings>
    <add key="PageInspector:ServerCodeMappingSupport" value="disabled"/>
</appSettings>

没有帮助

[/Pages/TargetPage.aspx] System.Web.HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown. ---> System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> system.invalidOperationException: Stack empty.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.Stack`1.Pop()
   at Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.EndRendering(TextWriter writer,Object renderedobject)
   at System.Web.UI.RenderTraceListener.RenderTraceListenerList.EndRendering(TextWriter writer,Object renderedobject)
   at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,ControlAdapter adapter)
   at System.Web.UI.Control.RenderControl(HtmlTextWriter writer,ControlAdapter adapter)
   at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterasyncPoint)
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterasyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterasyncPoint)
   at System.Web.UI.Page.LegacyPageAsyncInfo.<CallHandlersPossiblyUnderLock>b__32(Object o)
   at System.Web.HttpContext.InvokeCancellableCallback(WaitCallback callback,Object state)
   at System.Web.UI.Page.LegacyPageAsyncInfo.CallHandlersPossiblyUnderLock(Boolean onPageThread)
   at System.Web.UI.Page.LegacyPageAsyncInfo.CallHandlers(Boolean onPageThread)
   at System.Web.HttpAsyncResult.End()
   at System.Web.UI.Page.LegacyAsyncPageEndProcessRequest(IAsyncResult result)
   at System.Web.UI.Page.AsyncPageEndProcessRequest(IAsyncResult result)

有什么办法可以避免例外吗?
非常感谢任何建议

解决方法

我在VS 2013中禁用了浏览器链接,并且能够看到错误的实际原因.浏览器链接设置时通常是底层的.你可以在这里看到如何禁用它: http://www.poconosystems.com/software-development/how-to-disable-browser-link-in-visual-studio-2013/

原文地址:https://www.jb51.cc/aspnet/251063.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐