简体   繁体   中英

Can't connect to shared hosting database with site

Slightly at my wits end. Built an application, running fine locally. Migrated my database to MSSQL without issue, uploaded the site, can't seem to get the application to connect to the database. Any page that accesses the database I get a generic error message.

I've tried all the separate combinations of connection strings I could think of using the Godaddy recommended connection strings. Perhaps I am overlooking something simple?

I'm using Entity Framework Code-First -- My context model is called CombosContext.

<add name="CombosContext" connectionString=" Server=jelatin.db.9508732.hostedresource.com; Database=jelatin; User ID=jelatin; Password=********; Trusted_Connection=False" providerName="System.Data.SqlClient" />

<remove name="LocalSqlServer"/>

<add name="LocalSqlServer" connectionString=" Server=jelatin.db.9508732.hostedresource.com; Database=jelatin; User ID=jelatin; Password=********; Trusted_Connection=False" providerName="System.Data.SqlClient" />

Server : jelatin.db.9508732.hostedresource.com

DB name : jelatin

user : jelatin

Table : Comboes

I'm unfamiliar with GoDaddy hosted SQL, but usually a connection string to MS SQL Server uses "Data Source" instead of "Server" and "Initial Catalog" instead of "Database".

UPDATE

I didn't realize Server and Database were allowed options in the Connection String. Sorry for the confusion.

Regarding the database itself - are you letting EF create the database? Does the user have permission on GoDaddy's system to create a database?

If you have already created the database, did you populate anything? I have found that EF Code First won't correctly populate the database if the database exists and the metadata table doesn't. If you can, try copying your local database up to GoDaddy, and see if the connection works.

Finally, for your generic error message - is it coming back in a 500 error? If so, have you tried using either IE or Chrome's dev tools to inspect the response? Better error information is usually hidden in there.

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