开发者

Sql Express DB in APP_DATA when using IIS Virtual Directory

开发者 https://www.devze.com 2023-01-19 13:32 出处:网络
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...

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开发者_Python百科 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!


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.


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号