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:
<configuration> <connectionStrings> <add connectionString="Server=myServerAddress;Database=myDataBase;ID=myUsername;Password=myPassword;Trusted_Connection=False" name="connectionName" providerName="System.Data.SqlClient" /> </connectionStrings> </configuration>
<connectionStrings> <add connectionString=Data Source=ServerIPAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword; /> </connectionStrings> </configuration>
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?