0
votes

I bought a windows "ultimate shared hosting" from godaddy. I've uploaded all the files that are required, the site works. When I created a database on myLittleAdmin and got the connection string from it. I put that connection string to my web.config file which is hosted on godaddy, but gives error whenever I send a query to the database from the hosted site. The string does works on localhost perfectly.

I just don't know where I did wrong.


This is the connection string:

<connectionStrings>
    <add name="GodaddyString" connectionString="Data Source=IP;Initial Catalog=db108;Integrated Security=False;User ID=USER;Password=PASS"
    providerName="System.Data.SqlClient" />
</connectionStrings>

This is the Web.config file:

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, 
please visit
  https://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <connectionStrings>
    <remove name="LocalSqlServer" />
<add name="GodaddyString" connectionString="Data 
Source=IP;Initial Catalog=db108;Integrated 
Security=False;User ID=USER;Password=PASSWORD" 
providerName="System.Data.SqlClient" />
  </connectionStrings>
  <system.web>
<trust level="Full" />
<compilation targetFramework="4.6.1" defaultLanguage="c#" />
<httpRuntime targetFramework="4.6.1" />
<urlMappings enabled="true">
  <add url="~/home" mappedUrl="~/index.aspx" />
  <add url="~/ourstory" mappedUrl="~/ourstory.aspx" />
  <add url="~/anual_report" mappedUrl="~/anual_report.aspx" />
  <add url="~/education" mappedUrl="~/education.aspx" />
  <add url="~/error" mappedUrl="~/error.aspx" />
  <add url="~/healthcare" mappedUrl="~/healthcare.aspx" />
  <add url="~/livelihood" mappedUrl="~/livelihood.aspx" />
  <add url="~/joinus" mappedUrl="~/joinus.aspx" />
  <add url="~/mobile-library_stem-project" mappedUrl="~/mlstem.aspx" />
  <add url="~/mission-vision-values" mappedUrl="~/mvv.aspx" />
  <add url="~/our_partners" mappedUrl="~/partners.aspx" />
  <add url="~/the_team" mappedUrl="~/theteam.aspx" />
  <add url="~/our_trustees" mappedUrl="~/trustees.aspx" />
  <add url="~/whole_school_transformation" mappedUrl="~/wst.aspx" />
  <add url="~/contact-us" mappedUrl="~/contact.aspx" />
  <add url="~/volunteer_with_us" mappedUrl="~/volunteers.aspx" />
  <add url="~/ayang@news" mappedUrl="~/ayangsnews.aspx" />
  <add url="~/our-advisors" mappedUrl="~/advisors.aspx" />
  <add url="~/editprofile" mappedUrl="~/editprofile.aspx" />
  <add url="~/change-password" mappedUrl="~/chgpassword.aspx" />
  <add url="~/change-email" mappedUrl="~/chgemail.aspx" />
  <add url="~/edit-user" mappedUrl="~/edituser.aspx" />
  <add url="~/delete-user" mappedUrl="~/deluser.aspx" />
  <add url="~/register-user" mappedUrl="~/adduser.aspx" />
  <add url="~/gallery" mappedUrl="~/gallery.aspx" />
  <add url="~/Gallery/hummingbird-school-picture_viewer" mappedUrl="~/Gallery/gallerypart1.aspx" />
  <add url="~/Gallery/whole-school-transformation-picture_viewer" mappedUrl="~/Gallery/gallerypart2.aspx" />
  <add url="~/Gallery/library-program-picture_viewer" mappedUrl="~/Gallery/gallerypart3.aspx" />
  <add url="~/Gallery/video-album_player" mappedUrl="~/Gallery/gallerypartvideo.aspx" />
  <add url="~/ayang_manthan_fellowship" mappedUrl="~/manthanedufellow.aspx" />
  <add url="~/newsletter" mappedUrl="~/newsletter.aspx" />
  <add url="~/newsletterdel" mappedUrl="~/newsletterdel.aspx" />
  <add url="~/userdashboard" mappedUrl="~/userdashboard.aspx" />
  <add url="~/usereditprofile" mappedUrl="~/usereditprofile.aspx" />
  <add url="~/useremailedit" mappedUrl="~/useremailedit.aspx" />
  <add url="~/dashboard" mappedUrl="~/dashboard.aspx" />
  <add url="~/usereditpassword" mappedUrl="~/usereditpassword.aspx" />
  <add url="~/blogedit" mappedUrl="~/userblogedit.aspx" />
</urlMappings>
<customErrors mode="Off" />
  </system.web>
  <system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
  <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
  <remove name="OPTIONSVerbHandler" />
  <remove name="TRACEVerbHandler" />
  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
  </system.webServer>
  <system.net>
<mailSettings>
  <smtp>
    <network host="relay-hosting.secureserver.net" port="25" />
  </smtp>
</mailSettings>
  </system.net>
      <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
    <bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
  </dependentAssembly>
</assemblyBinding>
  </runtime>
  <system.codedom>
  </system.codedom>
</configuration>

This is the Error I get whenever I send a query from the hosted site:

Server Error in '/' Application.

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)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:

System.Data.SqlClient.SqlException: 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)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[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)] System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager) +907 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +334 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +38 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +699 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +89 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +426 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource 1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +78 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource 1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +191 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource 1 retry, DbConnectionOptions userOptions) +154 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource 1 retry, DbConnectionOptions userOptions) +21 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource 1 retry) +90 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource 1 retry) +443 System.Data.SqlClient.SqlConnection.Open() +96 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +120 System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) +160 System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) +108 Ayang_Final_Website.login.Login_button_Click(Object sender, EventArgs e) in C:\Users\Jaevein\Desktop\website\Ayang Final Website\Ayang Final Website\login.aspx.cs:39 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9782698 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +204 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1639

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3394.0

1
Welcome to SO ! Please delete your connection string details, server..., ID, Password etc. We never post such things publicly. Let that there isn't any firewall, someone could connect to your database... - Christos
There are a lot of duplicate questions for that error. Either the server IP is wrong or you have no access to that IP from wherever you're trying to connect. Unless the site and database are hosted by GoDaddy you won't be able to connect using an IP without the necessary networking configuration - Panagiotis Kanavos
The asp web pages which are uploaded on godaddy's httpdocs folder is sending the query to a remote sql server... and I'm receiving this error.. What Should I Do? - Jaevein
But Using the same IP address, I'm being able to access the info from localhost - Jaevein
@Jaevein is the server up? Is you web server configured to connect to the database? There's no ambiguity about this error, and you'll find a lot of duplicate questions. As for why you can't connect, it's probably because that's an external IP that's not visible inside GoDaddy's network. Or their firewalls aren't configured to allow your web server to connect to the database. Or you forgot to enable that connection in the admin tool - Panagiotis Kanavos

1 Answers

0
votes

This error often comes when your application is hosted on other server and Godaddy DB server down for moment.