Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been working on a C# MVC4 website and trying to publish it to a Host Gator shared Windows hosting account. They are running both MSSQL 2008 and mySql. We have run into some trouble when trying to get the site to work.

First of all we are using the code first approach to database creation with MVC as well as implementing the SimpleMembership that it offers.

If I publish a basic MVC website as created by a Visual Studios 2010 template, the site will load and display pages, as long as it does not attempt to connect to a database.

I have worked with the Host Gator technical support but they are unable to give me a good answer on how to actually connect to the database. And I have tried all manner of conneciton strings, as well as trying to implement SqlServerCe 3.5.

Some of the connection string examples I have tried are as follows:

        <add connectionString="Server=myServerAddress;Database=myDataBase;ID=myUsername;Password=myPassword;Trusted_Connection=False" name="connectionName" providerName="System.Data.SqlClient" />

and this:

                <add connectionString=Data Source=ServerIPAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword; />

But nothing seems to work, we end up with errors all over the place such as:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

It all points to connection strings and not being able to connect.

Does any one have any success stories with HostGator and MVC?

share|improve this question
I've just uploaded my website (not MVC) successfully in host gator with the help of their experts. My problems was the same as yours due to the connection string. Try to change like belows on the Data Source statement: ___ Data Source = localhost ___ Good luck – user288834 May 13 '15 at 16:57
up vote 2 down vote accepted

I'm guessing they don't provide RDP access. If so, first thing I would do is attempt to ping the sql server, and try to create a system DSN using odbcad32, and verify that the database is accessible independent of the application.

If your database is not the only or default instance on the SQL server, you may need to specify the instance name in the connection string:


It's possible to further craft the connection string to specify tcp/ip and the SQL port number:


Another technique that may help provide more information is to perform some other tests in your global.asax.cs, independent of the database access that uses the connections tring, such as pinging the sql server, and attempting to establish a simple tcp connection to the SQL server on 1433.

share|improve this answer
I ran through several attempts at using an instance name such as \SQLEXPRESS and \SQLSERVER2008 as some had suggested. No dice. HostGator Also has the Sql server listening on the default port. I was able to make a basic sql connection on the index page and it was successful, coupled wiht your answer and this I was able to conenct to the DB i think, I am now getting a dbo.table does not exist. Thanks! – sec_goat Feb 3 '13 at 16:14
Is that supposed to be a colon after tcp? Instead of server=serverName is it supposed to be tcp:serverName? – TankorSmash Feb 3 '13 at 17:09
Oh I see, server=tcp:servername… – TankorSmash Feb 3 '13 at 17:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.