EF和.NET 4提升“无法打开数据库” [英] EF and .NET 4 Raising "Cannot Open Database"

查看:87
本文介绍了EF和.NET 4提升“无法打开数据库”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个项目是我第一次加入VS2010,EF和.NET 4.0。 在开发环境中,一切正常。 在测试环境中,它没有。 


$
在我们的测试环境中,我们在Win 2003 Server(IIS 6)上运行网站,Web应用程序池使用了特定的域用户(appWebPool01),连接字符串指向使用集成的
安全性的2005 SQL Server实例。 在数据库中,域用户(appWebPool01)具有适当的权限(是架构所有者)。 (它实际上是从开发环境恢复,在开发环境中,我们没有问题)(出于调试目的,DBA为appWebPool 用户提供了
数据库的dbo)。 但是在测试环境中,当Web应用程序尝试连接到数据库时,SQL Server会抛出:
无法打开数据库"< databasename>"登录请求。登录失败。

用户'appWebPool01'登录失败。



关于SQL服务器,我们可以看到报告的登录失败。这是SQL错误
18456,state 16,
根据
http://sqldbpool.com/2009/04/24/error-18456-severity-14-login-failed-states/
表示用户没有对taget数据库的权限。 实际上,DBA已经将用户dbo设置为数据库,所以这对我们没有任何意义。



因为我们做同样的事情(使用一个域帐户作为Web池标识,并使用该标识连接到SQL Server)与.Net 3.5和Linq到Sql使用相同的框,并且没有任何问题,它对我们来说就像一个.Net 4或EF发行
或某种;感觉就像Web服务器将用户名传递给SQL Server,但不传递任何实际凭据。 就像4.0可能会以不同于3.5的方式传递凭证。



如果您有一些见解,我将不胜感激。

谢谢

Jim



解决方案

< blockquote>

嗨Jim,


当您从Dev环境恢复数据库时,似乎登录模式已损坏。


请尝试以下操作:


方法1


=======


a。确保您拥有数据库的备份。


b。 删除并再次添加"Domain\appWebPool01"登录信息。


方法II


========


关注 http://support.microsoft.com/kb/918992/en-us


请告诉我们是否可以帮助您解决问题。


问候,


〜周杰伦[MSFT]


 


 


 


This project is my first to include VS2010, EF and .NET 4.0.  In the development environment, everything works fine.  In the test environment, it does not. 

In our test environment, we are running the web site on a Win 2003 Server (IIS 6), the web application pool uses a specific Domain User (appWebPool01), and the connection string is pointing to an instance of a 2005 SQL Server using integrated security.  In the database, the domain user (appWebPool01) has appropriate authority (is the schema owner). (it's actually a restore from the dev envionment, and in the dev environment, we have no problem) (for debugging purposes, the DBA made appWebPool user the dbo for the database ).  But in the test environment, when the web app tries to connect to the database, SQL server throws a: Cannot open database "<databasename>" requested by the login. The login failed.
Login failed for user 'appWebPool01'.

On the SQL Server, we can see the login failure being reported. It is SQL error 18456, state 16, which according to http://sqldbpool.com/2009/04/24/error-18456-severity-14-login-failed-states/, means that the user doesn't have permissions to the taget database.  In fact, the DBA has made the user dbo to the database, so this doesn't make any sense to us.

Since we do this same thing (use a domain account as the web pool identity, and connect to SQL Server using that identify) with .Net 3.5 and Linq to Sql with the same boxes, and have no problems, it feels to us like a .Net 4 or EF issue or some sort; it feels like the web server is passing the user name to SQL Server, but not passing along any actual credentials.  Like maybe 4.0 is passing around credentials differently than 3.5.

If you have some insights, I'd be grateful.
Thanks
Jim

解决方案

Hi Jim,

It appears that when you restored your database from your Dev environment login schemas got corrupted.

Try the following:

Method 1

=======

a. Make sure that you have a backup of the database.

b. delete and add the 'Domain\appWebPool01' login again.

Method II

========

Follow http://support.microsoft.com/kb/918992/en-us

Let us know if it helps you in resolvnig the issue.

Regards,

~Jay [MSFT]

 

 

 


这篇关于EF和.NET 4提升“无法打开数据库”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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