New website database problems

Discussion in 'Databases' started by siermac, Jun 17, 2011.

  1. I just got my website online today and I can visit it with no problems, however the database that I use with the site isn't connecting properly.

    I uploaded the script and I can see the database with all the tables in MS SQL Server Management Studio logged into the Winhost server.

    When I visit the site and try to login or view a page that requires a connection to the database I get this error:

    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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

    Do I need to go through my whole site and change all my SQL DataSources to access the one online or just change the ones in the web.config file? Or is there something else I am missing?

    Here's a look at part of my web.config file:

    <connectionStrings>
    <add name="MySqlConnection" connectionString="Data Source=localhost;Initial Catalog=PTE Inventory;Integrated Security=True" />
    <add name="PTE InventoryConnectionString" connectionString="Data Source=CHRIS-PC;Initial Catalog=&quot;PTE Inventory&quot;;Integrated Security=True"
    providerName="System.Data.SqlClient" />
    <add name="PTE InventoryConnectionString2" connectionString="Data Source=CHRIS-PC;Initial Catalog=&quot;PTE Inventory&quot;;Integrated Security=True"
    providerName="System.Data.SqlClient" />
    </connectionStrings>
    <system.web>
    <compilation debug="true" targetFramework="4.0"/>
    <authentication mode="Forms">
    <forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
    </authentication>
    <membership>
    <providers>
    <clear/>
    <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="MySqlConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
    </providers>
    </membership>
    <profile>
    <providers>
    <clear/>
    <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="MySqlConnection" applicationName="/"/>
    </providers>
    </profile>
    <roleManager enabled="true">
    <providers>
    <clear />
    <add connectionStringName="MySqlConnection" applicationName="/"
    name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
    <add applicationName="/" name="AspNetWindowsTokenRoleProvider"
    type="System.Web.Security.WindowsTokenRoleProvider" />
    </providers>
    </roleManager>
     
    Last edited by a moderator: Oct 14, 2015
  2. Figured it out

    Nevermind I got i figured
     
  3. Any update on how you fixed this issue?
     
  4. Fixed

    Fixed the issue by changing the two connection strings I had set to my local server to the string provided with the database i created in my Winhost account.
     
    Last edited by a moderator: Oct 14, 2015

Share This Page