使用 IIS 虚拟目录时 APP_DATA 中的 Sql Express DB

发布于 2024-09-27 07:24:43 字数 359 浏览 0 评论 0原文

我想设置一个使用位于 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一腔孤↑勇 2024-10-04 07:24:43

检查服务器配置管理器中的 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.

鲜血染红嫁衣 2024-10-04 07:24:43

好吧,事实证明应用程序池在 IIS 中将“加载用户配置文件”设置为“False”。这会导致错误:

生成用户实例失败
SQL Server 由于失败
检索用户的本地
应用程序数据路径。请使
确保用户有本地用户配置文件
在计算机上。连接将
被关闭。 [客户:]

我不记得为什么会发生这种情况,也不记得它意味着什么,或者更改它是否存在安全风险,但我总是遇到这个问题,并将其设置为“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:

Failed to generate a user instance of
SQL Server due to failure in
retrieving the user's local
application data path. Please make
sure the user has a local user profile
on the computer. The connection will
be closed. [CLIENT: ]

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文