简体   繁体   中英

hosting asp.net

I have an asp.net application and i use the login control. It uses the default aspnetdb.mdf. Everything worked fine on the local network but when i hosted the website on the internet, the login doesnt work. It gave me 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. "

my connection string for the database is:

<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />

User Instances (the AttachDBFilename part of your connection string) is a feature of SQL Server Express, and I am guessing your host services use the full version of SQL Server (that does not support that feature).

You will probably need to connect to your hosted SQL Server using SQL Server Management Studio and upload your database there. Then you will need to update your connection string to point to that server/database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM