使用 IIS 虚拟目录时 APP_DATA 中的 Sql Express DB
我想设置一个使用位于 APP_DATA 文件夹中的 SQL Express .mdf 文件的网站。当我将站点创建为文件系统网站时,它可以毫无问题地连接到数据库文件...
但是,当我在 IIS 中创建相同的站点并且达到它想要附加到 SQL Express 数据库的程度时,它说无法连接。
我有点不知道它们有何不同,因为我只使用过完整的 SQL Server,即创建一个新数据库并设置连接字符串。这个sql express站点似乎只是“拾取”本地数据库。它似乎在文件系统模式下自动执行此操作...
有人可以向我提供一些关于它们有何不同的见解吗?a)我可以在使用 IIS 而不是文件系统时执行相同的操作,b)这是如何完成的(我在想权限?)
谢谢!
I want to setup a website that uses an SQL Express .mdf file located in the APP_DATA folder. when I create the site as a file-system website, it connects to the database file without issue...
however when I create the same site in IIS and I get to the point where it wants to attach to the SQL Express database, it says it cannot connect.
I'm kind of lost as to how these are different, as I've only ever used the full SQL Server, that is creating a new database and setting connection strings. This sql express site seems to just "pick up" the local database. It appears to be doing this automatically in file-system mode...
can someone provide me with some insight as to how these are different and if a) I can do the same thing when using IIS instead of the file-system and b) how this would be done (I'm thinking permissions?)
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查服务器配置管理器中的 SQL Express 设置。确保允许远程连接并检查您的防火墙设置。
默认情况下,SQL Express 中不允许远程连接。
Check Server Configuration Manager on your SQL Express setting. Make sure remote connections are allowed and also check your firewall settings.
By default remote connections are not allowed in SQL Express.
好吧,事实证明应用程序池在 IIS 中将“加载用户配置文件”设置为“False”。这会导致错误:
我不记得为什么会发生这种情况,也不记得它意味着什么,或者更改它是否存在安全风险,但我总是遇到这个问题,并将其设置为“True”完全解决了问题!
谁能告诉我更多关于这个设置的用途以及为什么它总是被设置为 false?
okay, it turns out that the Application Pool had the "Load User Profile" setting to "False" in IIS. This results in the error:
I don't remember why this happens or what it means, or if changing it is a security risk, but I ALWAYS encounter this problem, and setting it to "True" completely fixed the problem!
can anyone tell me more about what this setting is for and why it keeps getting set to false?