locked
Connecting Entity Framework website to GoDaddy database RRS feed

  • Question

  • User-1186725806 posted

    Hi, I first started reading these threads: GoDaddy + SQL Connection String and GoDaddy Database Connect example? , I tried every solution suggested but none worked. So here is my situation:

     My website is basic, it uses ASP.NET on the framework 4.5 and Entity Framework 6. I'm currently trying to host it on a GoDaddy server. The hosting plan doesn't belong to my account, but I was given admin rights to it. Also, I have full access to all the aspects of the project.

    Here are my connection string settings in Web.config (sensitive info replaced):

    <connectionStrings>
        <remove name="LocalSqlServer"/>
        <add name="ModelContainer" connectionString="metadata=res://*/Backend.Model.csdl|res://*/Backend.Model.ssdl|res://*/Backend.Model.msl;provider=System.Data.SqlClient;provider connection string='Data Source=a2nwplsk14sql-v01.shr.prod.iad2.secureserver.net;Database=Database_Name;User Id=My_User_Login;Password=My_Password;persist security info=False;MultipleActiveResultSets=True;Trusted_Connection=True;App=EntityFramework;Integrated Security=False'" providerName="System.Data.EntityClient"/>
    </connectionStrings>

    The website itself runs alright. I can access the first page (that doesn't access the database until you click something) without problem. On the other side, my database runs alright too. I can access it with my credentials using GoDaddy's database tool, SQL Management Studio and Visual Studio.

    So, when the site tries to connect to the database, it waits for about 15 seconds then a Server Error page shows up:

    [SqlException (0x80131904): 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)]

    So this is my problem, I really hope someone out there can help me resolve this. If you need more details I'll be sure to give them the fastest possible.

    Thank you!

    Thursday, January 14, 2016 11:31 PM

Answers

  • User177399542 posted

    Hi CoKorum here is my Connection I am using on godaddy server hope it helps you:

     <add name="MyEntities" connectionString="metadata=res://*/App_Code.myBlogModel.csdl|res://*/App_Code.myBlogModel.ssdl|res://*/App_Code.myBlogModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source= IPAddressOfGODaddySQLServer;Initial Catalog=MyDBName;User ID=MuUSerId;Password=MyPassword;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient"/>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 18, 2016 3:56 AM

All replies

  • User177399542 posted

    1) Try login using SQL Server management studio.

    2) Try  Changing: a2nwplsk14sql-v01.shr.prod.iad2.secureserver.net this to IP address of the SQL server.

    3) Try removing: Trusted_Connection=True

    Friday, January 15, 2016 3:59 AM
  • User-1186725806 posted

    Hi, I tried the 3 options you suggested and still the same result Frown 

    However, I checked in ASP.NET configuration (in GoDaddy's admin tool) and there it's written that "ModelContainer" connection string is:

    metadata=res://*/Backend.Model.csdl|res://*/Backend.Model.ssdl|res://*/Backend.Model.msl;provider=System.Data.SqlClient;provider connection string="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"

    It looks problematic, because it's very different to what I have in my Web.config. Can changing this string in the tool do the trick?

    Friday, January 15, 2016 6:05 PM
  • User177399542 posted

    Hi CoKorum here is my Connection I am using on godaddy server hope it helps you:

     <add name="MyEntities" connectionString="metadata=res://*/App_Code.myBlogModel.csdl|res://*/App_Code.myBlogModel.ssdl|res://*/App_Code.myBlogModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source= IPAddressOfGODaddySQLServer;Initial Catalog=MyDBName;User ID=MuUSerId;Password=MyPassword;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient"/>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 18, 2016 3:56 AM