用户“用户名"的登录失败-外部项目/类库中具有LINQ的System.Data.SqlClient.SqlException [英] Login failed for user 'username' - System.Data.SqlClient.SqlException with LINQ in external project / class library

查看:51
本文介绍了用户“用户名"的登录失败-外部项目/类库中具有LINQ的System.Data.SqlClient.SqlException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这看起来似乎很明显,但是当尝试在单独的类库项目中将LINQ to SQL与我的业务逻辑一起使用时,出现了此错误.

This might seem obvious but I've had this error when trying to use LINQ to SQL with my business logic in a separate class library project.

我已经在类库中创建了DBML,并在该项目中包含了所有业务逻辑和自定义控件.我从Web项目中引用了类库,并尝试直接从Web项目中使用它.

I've created the DBML in a class library, with all my business logic and custom controls in this project. I'd referenced the class library from my web project and attempted to use it directly from the web project.

该错误表明我的用户名登录失败.我的用户名和密码是正确的,但解决方法是将我的连接字符串复制到正确的位置.我已经从另一个站点了解到该问题,并认为我会在此处做一个记录.

The error indicated the login failed for my user name. My user name and password were correct, but the fix was to copy my connection string to the correct location. I've learned the issue from another site and thought I would make a note here.

错误: 用户用户名"的登录失败 System.Data.SqlClient.SqlException

Error: Login failed for user 'username' System.Data.SqlClient.SqlException

推荐答案

LINQ设计器将连接字符串通告到类库的app.config中,但是该网站需要在Web的web.config中看到它.项目.一旦复制到所有文件中就很好了.

The LINQ designer ads the connection string to the app.config of the class library, but the web site needed to see it in the web.config of the web project. Once copied across all was well.

这篇关于用户“用户名"的登录失败-外部项目/类库中具有LINQ的System.Data.SqlClient.SqlException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆