failure to connect to SQL server

Discussion in 'Databases' started by davidls, Mar 10, 2010.

  1. I am setting up a new site with a membership login db and having problems connecting. This is the connection string:
    connectionStrings>
    <remove name="LocalSqlServer"/>
    <add name="LocalSqlServer"
    connectionString="Data Source=tcp:02.Winhost.com;Initial

    Catalog=DB_5303_****_;User

    ID=DB_5303_tss1_user;Password=*********;IntegratedSecurity=Fal

    se;ProviderName=System.Data.SqlClient"/>
    </connectionStrings>

    and the error message is:

    TITLE: Connect to Database Engine
    ------------------------------

    Cannot connect to http://s02.Winhost.com.

    ------------------------------
    ADDITIONAL INFORMATION:

    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)

    (Microsoft SQL Server, Error: 123)

    For help, click: http://go.microsoft.com/fwlink?

    ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=123&

    LinkId=20476

    Any help you can provide would be appreciated.
     
    Last edited by a moderator: Oct 14, 2015
  2. Ray

    Ray

    The sql server name is wrong. In your connect string you have..

    02.Winhost.com

    ... you'll need to put s02.Winhost.com
     
    Last edited by a moderator: Oct 14, 2015
  3. I corrected the sql server name and am stil getting the same error message. I am following KB/a628 and these are the steps I'm using.

    To run the script:

    1. open MS SS management studio 2008
    2. open aspnetdb.mdf.sql and add two lines DBname and go at top
    3. open New Query (connect to server)
    Database Engine
    http://s02.Winhost.com
    SQL ServerAuthentification
    DB_5303_tss1_user
    951******
    press connect
    receive same error message as first post
     
    Last edited by a moderator: Oct 14, 2015
  4. Ray

    Ray

    The article you are mentioning..

    http://support.Winhost.com/KB/a628/using-the-microsoft-iis-70-manager.aspx

    ...is the KB article for connecting to our server using IIS 7 Manager.

    Are you saying that you are getting the error...

    ---------------------------------

    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)

    (Microsoft SQL Server, Error: 123)

    ---------------------------------

    ...Inside the IIS 7 Manager? I don't think you are. What I suspect happening is that you have a web site on your computer and you are trying to setup ASP.Net Membership/roles provider. In order to do this you first need to set it up on your computer then upload it to our server.

    Try using this kb article on how to setup ASP.Net Membership/Roles provider. Remember,first you have to set it up on your computer. This is because you need to use ASP.Net Configuration Tool on Visual Studio to define the membership and roles.

    http://support.Winhost.com/KB/a619/how-to-configure-the-aspnet-20-membershiproles-provider.aspx

    The error you are getting is specifically related to a network connection issue. This can be caused by any number of things. One of the most common ones is that the connection string is not up set correctly. If you are using IIS 7 Manager, then I suspect you are updating the connection string of the web pages that is on our server, but you are pulling up your web page that is on your computer. The web pages on your computer may not have the correct connection string. You maybe getting the misperception that you did setup the connection string correctly but in reality it is only setup on our server and not your local computer.

    The second common sceneario is that you did setup the connection string correctly on your web sites that is on your computer, but your computer (or your network) is blocking the SQL port. The port that SQL uses to connect to our SQL server is port 1433. You can test to see if this port is being blocked by performing a telnet test against port 1433. If you get a connection error then you will know that it is benig blocked. You will need to open this port on your network to connect to our SQL server.

    telnet s02.Winhost.com 1433
     
    Last edited by a moderator: Oct 14, 2015
  5. Ray
    Should have read KB/a694. Sorry about that!
    telnet to s02.Winhost.com 1433 did not return an error, looked like it just timed out.
    I modified win.config on my computer and then ftp uploaded with Filezilla so they should be the same.
     
    Last edited by a moderator: Oct 14, 2015
  6. Ray

    Ray

    So are you still getting the same error message?

    What do you mean ..

    telnet to s02.Winhost.com 1433 did not return an error, looked like it just timed out.


    It should not time out. What is the exact error message?
     
    Last edited by a moderator: Oct 14, 2015
  7. Ray
    I was able to connect and execute the .sql file. The problem was caused because I had entered http:// in front of the server name.

    I'm not sure the .sql file executed properly. The botton line showed these values:
    query execute s02.Winhost db user db pw time 1:08 0 rows 0

    and there were messages that read 1Row(s) affected Rows returned 0

    When I login to my web site there is an error message that says IntegratedSecurity is not supported. I will try again tomorrow.
     
    Last edited by a moderator: Oct 14, 2015
  8. Ray

    Ray

    Whats the full and exact error message?
     
  9. Ray
    I republished the .sql file to the db server and everythig looks good except when I login for the members only (on my web site) I get this error page.

    Server Error in '/' Application.
    --------------------------------------------------------------------------------

    Keyword not supported: 'provider name'.
    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.ArgumentException: Keyword not supported: 'provider name'.

    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:


    [ArgumentException: Keyword not supported: 'provider name'.]
    System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +4910580
    System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +98
    System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +55
    System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
    System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +200
    System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) +62
    System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +4
    System.Data.SqlClient.SqlConnection..ctor(String connectionString) +24
    System.Web.DataAccess.SqlConnectionHolder..ctor(String connectionString) +54

    [ArgumentException: An error occurred while attempting to initialize a System.Data.SqlClient.SqlConnection object. The value that was provided for the connection string may be wrong, or it may contain an invalid syntax.
    Parameter name: connectionString]
    System.Web.DataAccess.SqlConnectionHolder..ctor(String connectionString) +136
    System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +134
    System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +815
    System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +105
    System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved) +42
    System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +78
    System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e) +60
    System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +119
    System.Web.UI.WebControls.Login.AttemptLogin() +115
    System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +101
    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
    System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +118
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +166
    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565




    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET Version:2.0.50727.4016
     
  10. Ray

    Ray

    There's something about this name 'provider name' that your application doesn't like. Base off the stack trace I suspect the error is being generated from within your web.config file. Try going to that applications web.config file and see if you can find an element with 'provider name'.
     
  11. Ray
    My membership login is now working. The problem was resolved by removing the connection string info from web.config in the root directory and from the Members directory web.config (contains info specific to the login). I then used IIS management to add the connection string from the Winhost db contol panel (without the quotes and also checking the password). The Members web.config connection string inherited the change.

    I do have a question about authorizations. I set the Members folder to denied for anonymous users. This works on local host but not on the web. How do I fix this? The onlly change was adding the connection string.
     
    Last edited by a moderator: Oct 14, 2015
  12. Ray

    Ray

    What do you mean by "I set the Members folder to denied for anonymous users", where did you exactly set this.

    The membership and roles are typically set in the ASP.Net Configuration Tool inside Visual Studio.
     

Share This Page