0

我很抱歉这是一个非常陈词滥调的问题,但我真的需要了解一些具体的事情。

每次我在 Visual Studio 2010 中添加一个 sql server 数据库时,它都会在 App_Data 下创建一个数据库,然后服务器资源管理器使用的连接字符串是一个具有指向该文件的 AttachDb 字段的连接字符串。

现在,当我在 2 台 IIS 服务器 6 和 7.5 上尝试时,我遇到了很多错误说用户

"An attempt to attach an auto-named database for file XX failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share."

如果我使用这种格式 "Server=\sqlexpress;Database=xxx;Trusted_Connection=True" 我得到

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.

我花了一整天的时间尝试各种不同的连接字符串、配置和组合!!=S

我的问题是:这样做的正确方法是什么?我应该在 sql management studio 2008 R2 express 中制作数据库吗?我需要什么样的连接字符串,在 SQL SERVER 2008 R2 Express IIS Windows Server 2003 R2 上需要什么配置?

4

1 回答 1

0

似乎我需要使用集成安全(Windows 身份验证)连接字符串,我还必须使用 localhost\sqlexpress 而不是 .\sqlexpress。对于 IIS 7.5,需要将应用程序池登录名添加到 sql 服务器登录名中!

于 2010-06-26T14:48:35.510 回答