为 asp.net 3.5 数据库应用程序安装和配置 sql server 和 IIS [基础]
我很抱歉这是一个非常陈词滥调的问题,但我确实需要了解一些具体的事情。
每次我在 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 上需要什么配置?
I'm very sorry about this being a very cliché question, but I really need to understand some specific things.
Everytime I add an sql server database in visual studio 2010 it creates a database under App_Data and then the connection string the server explorer uses is one which has an AttachDb field that points to the file.
Now when I tried that on 2 IIS servers 6 and 7.5 I had a slew of errors saying the user
"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."
if I use this format "Server=\sqlexpress;Database=xxx;Trusted_Connection=True" I get
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.
I spent a whole day trying all kinds of different connection strings, configurations, and combinations!! =S
My question is : What is the RIGHT way this is to be done? Should I make the database in sql management studio 2008 R2 express? What KIND OF connection string do I need, and what config do I need on SQL SERVER 2008 R2 Express IIS Windows Server 2003 R2?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
似乎我需要使用集成安全性(Windows 身份验证)连接字符串,我还必须使用 localhost\sqlexpress 而不是 .\sqlexpress。对于 IIS 7.5,需要将应用程序池登录添加到 sql 服务器登录中!
seems I need use the integrated security(windows authentication) connection string, also I had to use localhost\sqlexpress instead of .\sqlexpress. For IIS 7.5 an app pool login needs to be added into sql servers logins!