Page view counter

Need to get ASPNETDB.MDF to work on remote server

Last post 06-17-2008 9:59 PM by jpcoliveros. 3 replies.

Sort Posts:

  • Need to get ASPNETDB.MDF to work on remote server

    06-17-2008, 2:00 PM
    • Loading...
    • drocco
    • Joined on 03-25-2008, 1:39 AM
    • Posts 433
    • Points 460

    My website is hosted remotely by a separate company, but I test it locally before launching anything

    I wanted to set up an administrator portal for it, so I used WAT to configure membership/roles

    It automatically created the database ASPNETDB.MDF and updated my web.config file

    Everything worked fine locally, but after uploading it to the remote server, I got the error  

    An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

    So I started reading some articles on this issue and the steps that I've taken to try and correct this so far have been to start from scratch, delete the automatically created database and then use aspnet_regsql to create a new one

    Then I used WAT to re-add my users/roles

    Then I changed my web.config in the following areas

      <connectionStrings>
        <remove name="LocalSqlServer" />
        <add name="LocalSqlServer" connectionString="connection string provided by hosting company" providerName="System.Data.SqlClient=" />
      </connectionStrings>

         <authentication mode="Forms" />

         <roleManager enabled="true">
          <providers>
            <clear />
            <add connectionStringName="LocalSqlServer" applicationName="/"
               name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
            <add applicationName="/" name="AspNetWindowsTokenRoleProvider"
               type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
          </providers>
        </roleManager>


        <membership>
          <providers>
            <clear/>
            <add name="AspNetSqlMembershipProvider"
                 type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                 connectionStringName="LocalSqlServer"
                 applicationName="/"
            />
          </providers>
        </membership>

    Then I uploaded the ASPNETDB.MDF and it's log file to the ~/App_Data directory and updated my web.config file on the remote server
     

    Now when I try to log in, I no longer receive the error, but it's telling me that my credentials are incorrect

    What's going on here? 

  • Re: Need to get ASPNETDB.MDF to work on remote server

    06-17-2008, 2:18 PM
  • Re: Need to get ASPNETDB.MDF to work on remote server

    06-17-2008, 2:22 PM
    • Loading...
    • drocco
    • Joined on 03-25-2008, 1:39 AM
    • Posts 433
    • Points 460

     Note in the code that I've posted that I already tried that

     The users and application tables used "/" so I declared that in the web.config 

  • Re: Need to get ASPNETDB.MDF to work on remote server

    06-17-2008, 9:59 PM
    Answer
    • Loading...
    • jpcoliveros
    • Joined on 01-06-2006, 1:54 AM
    • Philippines
    • Posts 338
    • Points 2,320
    • TrustedFriends-MVPs

    Does the host provide hosting for SQL Server Express Edition as well? The UserInstance property in the connection string declaration is not supported in the full-blown SQL Server instance. What you can do is that run aspnet_regsql to configure the database provided for you on the remote server. Otherwise, if you insist on using the ASP.NET database, ensure that there's a SSExpress instance present and verify with the hosting provider that you are getting the correct connection string name in order for SSExpress database to work in their servers.

    HTH 

    Patrick Oliveros
    Web Developer - Emerson Electric Asia, Ltd. - ROHQ
    webthinker.wordpress.com
Page 1 of 1 (4 items)