locked
SqlConnection.Open throws an unhandled exception RRS feed

  • Question

  • I have the same code on 400+ computers.  It has been running reliably for 7 years.

    Today, one of the computers lost connectivity and now, i have an unhandled exception i cannot find or fix.

    I have error handling all around the .Open call but, it is throwing an exception outside of my app.

    Here is the exact message from an app i threw together just to open a connection to the database on a computer in the same room:

    Event Type: Error
    Event Source: .NET Runtime
    Event Category: None
    Event ID: 1026
    Date:  10/1/2012
    Time:  7:09:19 PM
    User:  N/A
    Computer: S58_DC1
    Description:
    Application: ConnectionTest.exe
    Framework Version: v4.0.30319
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.Runtime.InteropServices.SEHException
    Stack:
       at System.Data.ProviderBase.DbConnectionPool+TransactedConnectionPool..ctor(System.Data.ProviderBase.DbConnectionPool)
       at System.Data.ProviderBase.DbConnectionPool..ctor(System.Data.ProviderBase.DbConnectionFactory, System.Data.ProviderBase.DbConnectionPoolGroup, System.Data.ProviderBase.DbConnectionPoolIdentity, System.Data.ProviderBase.DbConnectionPoolProviderInfo)
       at System.Data.ProviderBase.DbConnectionPoolGroup.GetConnectionPool(System.Data.ProviderBase.DbConnectionFactory)
       at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPool(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionPoolGroup)
       at System.Data.ProviderBase.DbConnectionFactory.GetConnection(System.Data.Common.DbConnection)
       at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionFactory)
       at System.Data.SqlClient.SqlConnection.Open()
       at ConnectionTest.Form1.Button1_Click(System.Object, System.EventArgs)
       at System.Windows.Forms.Control.OnClick(System.EventArgs)
       at System.Windows.Forms.Button.OnClick(System.EventArgs)
       at System.Windows.Forms.Button.OnMouseUp(System.Windows.Forms.MouseEventArgs)
       at System.Windows.Forms.Control.WmMouseUp(System.Windows.Forms.Message ByRef, System.Windows.Forms.MouseButtons, Int32)
       at System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)
       at System.Windows.Forms.ButtonBase.WndProc(System.Windows.Forms.Message ByRef)
       at System.Windows.Forms.Button.WndProc(System.Windows.Forms.Message ByRef)
       at System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)
       at System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
       at System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
       at System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
       at System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(System.String[])
       at ConnectionTest.My.MyApplication.Main(System.String[])

    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


    Steve

    Tuesday, October 2, 2012 12:21 AM

Answers

  • OK.  I finally got this one.  SFC /Scannow and then IPConfig /flushdns

    It took both steps.  Also, NamedPipes somehow was disabled on the DB machine.  I enabed that and restarted SQL.


    Steve

    • Marked as answer by Steve Frase Tuesday, October 2, 2012 2:25 AM
    Tuesday, October 2, 2012 2:25 AM

All replies

  • OK.  I finally got this one.  SFC /Scannow and then IPConfig /flushdns

    It took both steps.  Also, NamedPipes somehow was disabled on the DB machine.  I enabed that and restarted SQL.


    Steve

    • Marked as answer by Steve Frase Tuesday, October 2, 2012 2:25 AM
    Tuesday, October 2, 2012 2:25 AM
  • Thanks for sharing Steve

    Best Regards,
    Iric
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, October 2, 2012 2:54 AM