【问题标题】:ASP.net c# - Could not load typeASP.net c# - 无法加载类型
【发布时间】:2010-08-10 09:57:51
【问题描述】:

在我的页面上我有:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="siteSettings.aspx.cs" Inherits="APack.admin.siteSettings" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<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>

我的代码是:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace APack.admin
{
    public partial class siteSettings : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}

抛出异常:

Parser Error Message: Could not load type 'APack.admin.siteSettings'.

这是刚刚在Visual Studio中生成的,右键->新建文件。它只是不起作用:(有什么想法吗?

【问题讨论】:

    标签: c# asp.net


    【解决方案1】:

    您是否构建了应用程序?

    【讨论】:

    • 我的印象是,当我从服务器运行网页时,它会为您编译它?
    • 不知道为什么会起作用,但确实起作用了 :) 谢谢!有什么解释吗?
    • 一个Web site 项目是即时编译的。 Web Application 项目不是。
    • 你能澄清一下步骤吗?我尝试过使用相同的骨架应用程序并构建了该应用程序,然后发布它仍然出现该错误
    【解决方案2】:

    我想我找到了一种可能的解决方案,点击“项目名称”.“属性”,然后将“根命名空间”命名为Web应用程序名称,如“YourNamespace”,然后重新编译dll

    【讨论】:

    • 似乎没有任何改变
    【解决方案3】:

    我在这里回答了你的问题:C# Visual Studio 2010 - 'Could not load type' Parse error


    您在页面参考上方缺少您的程序集参考:

    <%@ Assembly Name="YOURASSEMBLY.NAME, Version=1.0.0.0, Culture=neutral, PublicKeyToken=YOURPUBLICKEYTOKEN" %>
    

    【讨论】:

      猜你喜欢
      • 2016-06-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多