.net – CS0012:类型’System.Data.Linq.DataContext’在未引用的程序集中定义

Helllo,我收到此错误

CS0246: The type or namespace name ‘DataClasses1DataContext’ Could not be found (are you missing a using directive or an assembly reference?)

对于此.aspx文件

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

public partial class WebApplication1_admin_Places : System.Web.UI.Page
{
    protected void Page_Load(object sender,EventArgs e)
    {
        DataClasses1DataContext db = new DataClasses1DataContext();
        var query = (from m in db.Places orderby m.Name select m);
        PlacesList.DataSource = query;
        PlacesList.DataBind();
    }
}

事情是,在/文件夹我可以访问数据库,但在/ admin文件夹我得到这个错误.

我究竟做错了什么?

编辑

CS0012:类型’System.Data.Linq.DataContext’在未引用的程序集中定义.您必须添加对程序集’System.Data.Linq,Version = 3.5.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089’的引用.

那是什么意思?

解决方法

几个地方开始:

>包含DataClasses1DataContext的dll在哪里?有没有理由可以从一个文件夹而不是另一个文件夹中找到它
> admin文件夹中是否有配置文件覆盖根配置文件中设置的值?

编辑

看起来这是一个配置问题.配置可能表示msl(模型)文件位于当前目录中,它位于根目录中.因此,当您在root上时它会起作用,但是当您在管理员中时它不起作用.

请参阅:MetadataException when using Entity Framework Entity Connection表示类似问题.

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....