none
SQL 2005 Exception With .Net Framework 4.5 RRS feed

  • Question

  • Hi, 

    I have a web application which is developed on VS 2010 and .Net 4.0 . This application connects to a third party SQL Server database which is on SQL Server 2005 version. 

    Every thing working fine till I upgraded to 4.5. For PCI compliance production server has to be upgraded to .net 4.5. Hence as a dry run,  I have upgraded development server which is Windows Server 2012 to VS 2013 and .net 4.5.2

    Now I am facing below exception when try to open SQL connection 

    {"A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)"}.

    Connection Says : {"Invalid operation. The connection is closed."} 

    for Connection sting I am using SqlConnectionStringBuilder with Data Source, inital catalog, user and password.


    Code : 

    SqlConnection connection = new SqlConnection();

    connection.ConnectionString = builder.ConnectionString; (with above said properties)

    connection.Open();

    Same connection string again works with odbc. 



    Thanks in advance. 

    Prasad Chillara



    • Edited by Prasad Chillara Thursday, September 25, 2014 3:24 AM
    • Moved by Bob Beauchemin Thursday, September 25, 2014 6:31 PM Moving to the forum for client-side ADO.NET (SqlClient) for best results
    Thursday, September 25, 2014 3:22 AM

All replies

  • Hello Prasad,

    >> Same connection string again works with odbc.

    If this means that when using odbc, it could work even upgraded development server which is Windows Server 2012 to VS 2013 and .net 4.5.2, while using SqlConnection, it only worked with original development.

    Since you upgrade three features at one time, it is hard to detect which upgrades cause this error. My suggestion to narrow down this issue is to make a test with these upgrades separately to see if it is the new Server or new Visio Studio or the new .NET Framework causes this error.

    And for the error, since we cannot reproduce it, what we can do is to provide some information regarding it:

    It could be any number of network issues. ANYTHING that prevents the code from reaching the server even for the few miliseconds it takes to make one query. Please have a try to run a small demo which connects to the database in a local environment to check if it works or not.

    Here is a link which is used to troubleshooting the forcibly closed connection issue which might be helpful:

    http://msdn.microsoft.com/en-us/library/ms187005.aspx

    Best Regards,

    Fred.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, September 26, 2014 2:58 AM
    Moderator
  • Thanks Fred.  Will try this. 

    Regards

    Prasad Chillara

    Sunday, September 28, 2014 12:32 AM
  • There is a correction in question. Today I came to know that, the third party database is SQL Server 7.

    Fred, 

    We have a server which is of Windows Server 2008 R2, VS 2010 and .net 4. Now for a compliance issue, we are upgrading it to .net 4.5.2. Though there is no development requirement to upgrade, this upgrade to 4.5.2 has become mandatory for Security compliance.

    Looks like the issue with 4.5.1 (https://support.microsoft.com/kb/2915689?wa=wsignin1.0) still exists in 4.5.2 for SQL Server 7.

    I am able to connect to another database which is SQL Server 2005 after upgrade.

    Did any one face this issue or any suggestions are appreciated.

    Thanks in advance.

    -Prasad


    Sunday, October 5, 2014 10:25 PM
  • Hello,

    >> Looks like the issue with 4.5.1 (https://support.microsoft.com/kb/2915689?wa=wsignin1.0) still exists in 4.5.2 for SQL Server 7.

    Since we cannot know reproduce this issue, my suggestion is to post this issue to site below and obtain a hotfix:

    http://answers.microsoft.com/en-us

    It is better to provide a detail information or they might consider it as a simple connection issue.

    Fred.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, October 6, 2014 7:33 AM
    Moderator
  • There is a correction in question. Today I came to know that, the third party database is SQL Server 7.

    The database should be updated to a newer version. Extended Support for SQL Server 7 ended 1/11/2011, so compatibility with newer versions of the .NET Framework cannot be guaranteed.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Monday, October 6, 2014 1:49 PM