Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 解析服务此请求所需的资源时出错_C#_Asp.net_Visual Studio 2013 - Fatal编程技术网

C# 解析服务此请求所需的资源时出错

C# 解析服务此请求所需的资源时出错,c#,asp.net,visual-studio-2013,C#,Asp.net,Visual Studio 2013,我有一个新的空页面,当我试图查看该页面时,错误页面如下所示: 这是页面来源: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test12.aspx.cs" Inherits="AEIC.Test12" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">

我有一个新的空页面,当我试图查看该页面时,错误页面如下所示:

这是页面来源:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test12.aspx.cs" Inherits="AEIC.Test12" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    </div>
    </form>
</body>
</html>
它的作者是:

1-将“构建操作”设置为内容

2-将“复制到输出目录”设置为始终复制

都是关于标签的

其他两种解决方案:

  • 使用CodeFile而不是CodeBehind(但请记住,这会以纯文本形式公开源代码,并在运行时编译)

  • 如果使用了正确的命名空间,请确保Inherits属性包含正确的命名空间。您可以在“应用程序”选项卡下的“项目属性”页中找到此选项


  • 我尝试了你的前两个解决方案,但没有成功。使用代码文件不是一个理想的选择,VisualStudio创建的新表单是否可能使用错误的名称空间?
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    namespace AEIC
    {
        public partial class Test12 : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
    
            }
        }
    }