gpt4 book ai didi

c# - 将表单标记添加到 ASP.Net Webforms 页面时出现空堆栈错误

转载 作者:行者123 更新时间:2023-11-30 19:26:15 25 4
gpt4 key购买 nike

好吧,我来自 ASP 编程世界 - ASP.NET 有点新,我使用的是 Visual Studio 2013。

所以,当我只是想构建一个简单的表单时,我收到了这条错误消息:

Server Error in '/' Application.

Stack empty.

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: Stack empty.

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: Stack empty.]
System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) +52
System.Collections.Generic.Stack`1.Pop() +6694385
Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.EndRendering(TextWriter writer, Object renderedObject) +85
System.Web.UI.RenderTraceListenerList.EndRendering(TextWriter writer, Object renderedObject) +58
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +142
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1386

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18408

这到底是什么意思?

当我输入 <form> 时,页面似乎中断了围绕这个标记:

    <form id="form1" runat="server">

<asp:TextBox ID="post_feedback" runat="server" Height="100" Width="500" BackColor="#0066FF" Font-Bold="True" ForeColor="#FF9933" Wrap="False" TextMode="MultiLine" BorderColor="#000099" BorderStyle="Groove" BorderWidth="2"></asp:TextBox>

</form>

但是当我删除表单标签并“运行”它时,我不会出现长堆栈错误。我什至还没有对 *.aspx.cs 文件做任何事情;没有函数调用,什么都没有。

那么这到底意味着什么呢?我真的迷路了。谢谢。

最佳答案

在 ASP.Net 中,除非您小心地指定一个没有 WebForms 的 MVC 站点,否则有一个 True FormTM。您不会将自己的表单标签添加到页面。您可以使用 Visual Studio 帮助您放入页面中的那种形式来处理从回发创建的事件。

关于c# - 将表单标记添加到 ASP.Net Webforms 页面时出现空堆栈错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24374283/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com