Pergunta

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!

Foi útil?

Solução 2

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?

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top