Initial publishing of database(s)

Discussion in 'Databases' started by trkkc, Jun 7, 2011.

  1. I am new to Winhost and to web development. I have just copy my website over and I believe successfully published my database. When I attempt to login to website, the login page comes up fine, but I get an error after I enter my username and password (to my website not to Winhost). The error reads "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible."

    In my web.config file, I realized that there is a second connection string to an "ApplicationServices" database. If I recall MS Visual Web developer automatically generates this database to store your security info.

    If I am wrong, please stop here and let me know what this is.

    If I am right, I seem to have a problem. I am on the basic plan that only allows 1 db. I see three possible solutions.
    1. I have to upgrade to host this second database with security info.
    2. I somehow add these to my one database
    3. There is a simply solution I am missing.

    I did notice that there is an "application starting point" on my site managment page. I am not sure if this has anything to do with my application services. Any input would help.
     
    Last edited by a moderator: Oct 14, 2015
  2. Ray

    Ray

    Last edited by a moderator: Oct 14, 2015
  3. Ray, thanks for the reply. I have taken a look at the KB article, and I am having some trouble figuring out the right step.

    It appears the article is taking me through steps that are already complete. I have already added the authentication function to the website and it is working fine when I run it locally.

    My web.config file contains the following connection string:

    <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>

    It is this aspnetdb.mdf that seems to be giving me grief. This DB resides on my PC right now, but I assume it must reside on the web server instead. The KB article seems to only walk through adding the local db.
     
  4. Looks like I figured it out. Thanks to the forum at

    http://forum.Winhost.com/showthread.php?t=8074&highlight=authentication

    I ended up adding the tables of the ASPNETDB.MDF to my DB_25454_IQDMS3 database on my website. I followed the same process of "publish to provider", and running the script, as I did when I initially posted my DB_25454_IQDMS3 database itself.

    I then modified my connection string in the web.config file from the string shown in my second post, the the following:

    <add name="ApplicationServices" connectionString="Data Source=tcp:s05.Winhost.com;Initial Catalog=DB_25454_iqdms;User ID=DB_25454_iqdms_user;Password=******;Integrated Security=False;" providerName="System.Data.SqlClient"/>

    This was a very simply and easy fix. I am not sure if it is the most efficient but it works. Hopefully this will help other newbees.
     
    Last edited by a moderator: Oct 14, 2015
  5. Ray

    Ray

    Glad you worked it out. For those of you who read this thread just keep in mind that the connection string...

    connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\asp netdb.mdf;User Instance=true"

    Means you are trying to connect to the mdf file directly. This will not work because it requires we install SQL Express on the server.
     
  6. I have no problem to connect from my developing machine to the db server but when attempting to connect from the website I get an error any help would be appreciated



    Code:
        <add name="ApplicationServices" connectionString="Data Source=tcp:s07.Winhost.com;Initial Catalog=DB_38507_bcl;User ID=DB_*****_bcl_user;Password=*******;Integrated Security=false;" providerName="System.Data.SqlClient"/>
    
    

    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)


    [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.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5064522
    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
     
    Last edited by a moderator: Oct 14, 2015
  7. Elshadriel

    Elshadriel Winhost Staff

    Have you checked to see if there is another connection string in the web.config file or in your code?
     

Share This Page