• 安装.NET Framework后程序无法启动的错误处理


    最近发现一直在使用的Database.NET软件无法正常使用了,表现为当尝试进行Sql Server的连接创建时,直接报错

    image

    在事件查看器具体错误信息为:

    日志名称:          Application

    来源:            .NET Runtime

    日期:            2015/6/13 21:05:56

    事件 ID:         1026

    任务类别:          无

    级别:            错误

    关键字:           经典

    用户:            暂缺

    计算机:           LAH-PC

    描述:

    应用程序: Database4.exe

    Framework 版本: v4.0.30319

    说明: 由于未经处理的异常,进程终止。

    异常信息: System.AccessViolationException

    堆栈:

    在 SNINativeMethodWrapper.SNIClose(IntPtr)

    在 System.Data.SqlClient.SNIHandle.ReleaseHandle()

    在 System.Runtime.InteropServices.SafeHandle.InternalDispose()

    在 System.Runtime.InteropServices.SafeHandle.Dispose(Boolean)

    在 System.Runtime.InteropServices.SafeHandle.Dispose()

    在 System.Data.SqlClient.TdsParserStateObject.Dispose()

    在 System.Data.SqlClient.TdsParser.Disconnect()

    在 System.Data.SqlClient.SqlInternalConnectionTds.LoginFailure()

    在 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(System.Data.ProviderBase.TimeoutTimer, System.Data.SqlClient.SqlConnectionString, System.Data.SqlClient.SqlCredential, System.String, System.Security.SecureString, Boolean)

    在 System.Data.SqlClient.SqlInternalConnectionTds..ctor(System.Data.ProviderBase.DbConnectionPoolIdentity, System.Data.SqlClient.SqlConnectionString, System.Data.SqlClient.SqlCredential, System.Object, System.String, System.Security.SecureString, Boolean, System.Data.SqlClient.SqlConnectionString, System.Data.SqlClient.SessionData)

    在 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(System.Data.Common.DbConnectionOptions, System.Data.Common.DbConnectionPoolKey, System.Object, System.Data.ProviderBase.DbConnectionPool, System.Data.Common.DbConnection, System.Data.Common.DbConnectionOptions)

    在 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionPoolGroup, System.Data.Common.DbConnectionOptions)

    在 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(System.Data.Common.DbConnection, System.Threading.Tasks.TaskCompletionSource`1<System.Data.ProviderBase.DbConnectionInternal>, System.Data.Common.DbConnectionOptions, System.Data.ProviderBase.DbConnectionInternal, System.Data.ProviderBase.DbConnectionInternal ByRef)

    在 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionFactory, System.Threading.Tasks.TaskCompletionSource`1<System.Data.ProviderBase.DbConnectionInternal>, System.Data.Common.DbConnectionOptions)

    在 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionFactory, System.Threading.Tasks.TaskCompletionSource`1<System.Data.ProviderBase.DbConnectionInternal>, System.Data.Common.DbConnectionOptions)

    在 System.Data.SqlClient.SqlConnection.TryOpenInner(System.Threading.Tasks.TaskCompletionSource`1<System.Data.ProviderBase.DbConnectionInternal>)

    在 System.Data.SqlClient.SqlConnection.TryOpen(System.Threading.Tasks.TaskCompletionSource`1<System.Data.ProviderBase.DbConnectionInternal>)

    在 System.Data.SqlClient.SqlConnection.Open()

    在 gVariables5.[1](System.String)

    在 frmMain.(System.String, Boolean)

    在 frmMain.(DatabaseType)

    在 frmMain.œ[1](System.Object, System.EventArgs)

    在 System.Windows.Forms.ToolStripItem.RaiseEvent(System.Object, System.EventArgs)

    在 System.Windows.Forms.ToolStripMenuItem.OnClick(System.EventArgs)

    在 System.Windows.Forms.ToolStripItem.HandleClick(System.EventArgs)

    在 System.Windows.Forms.ToolStripItem.FireEventInteractive(System.EventArgs, System.Windows.Forms.ToolStripItemEventType)

    在 System.Windows.Forms.ToolStripItem.FireEvent(System.EventArgs, System.Windows.Forms.ToolStripItemEventType)

    在 System.Windows.Forms.ToolStripItem.PerformClick()

    在 frmMain.‚[1](System.Object, System.EventArgs)

    在 System.Windows.Forms.ToolStripItem.RaiseEvent(System.Object, System.EventArgs)

    在 System.Windows.Forms.ToolStripMenuItem.OnClick(System.EventArgs)

    在 System.Windows.Forms.ToolStripItem.HandleClick(System.EventArgs)

    在 System.Windows.Forms.ToolStripItem.HandleMouseUp(System.Windows.Forms.MouseEventArgs)

    在 System.Windows.Forms.ToolStripItem.FireEventInteractive(System.EventArgs, System.Windows.Forms.ToolStripItemEventType)

    在 System.Windows.Forms.ToolStripItem.FireEvent(System.EventArgs, System.Windows.Forms.ToolStripItemEventType)

    在 System.Windows.Forms.ToolStrip.OnMouseUp(System.Windows.Forms.MouseEventArgs)

    在 System.Windows.Forms.ToolStripDropDown.OnMouseUp(System.Windows.Forms.MouseEventArgs)

    在 System.Windows.Forms.Control.WmMouseUp(System.Windows.Forms.Message ByRef, System.Windows.Forms.MouseButtons, Int32)

    在 System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)

    在 System.Windows.Forms.ScrollableControl.WndProc(System.Windows.Forms.Message ByRef)

    在 System.Windows.Forms.ToolStrip.WndProc(System.Windows.Forms.Message ByRef)

    在 System.Windows.Forms.ToolStripDropDown.WndProc(System.Windows.Forms.Message ByRef)

    在 System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)

    在 System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)

    在 System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)

    在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)

    在 System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)

    在 System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)

    在 System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)

    在 System.Windows.Forms.Application.Run(System.Windows.Forms.ApplicationContext)

    在 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()

    在 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()

    在 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(System.String[])

    在 ..(System.String[])

    事件 Xml:

    <Event xmlns='http://schemas.microsoft.com/win/2004/08/events/event'><System><Provider Name='.NET Runtime'/><EventID Qualifiers='0'>1026</EventID><Level>2</Level><Task>0</Task><Keywords>0x80000000000000</Keywords><TimeCreated SystemTime='2015-06-13T13:05:56.000000000Z'/><EventRecordID>39388</EventRecordID><Channel>Application</Channel><Computer>LAH-PC</Computer><Security/></System><EventData><Data>应用程序: Database4.exe

    Framework 版本: v4.0.30319

    说明: 由于未经处理的异常,进程终止。

    异常信息: System.AccessViolationException

    堆栈:

    在 SNINativeMethodWrapper.SNIClose(IntPtr)

    在 System.Data.SqlClient.SNIHandle.ReleaseHandle()

    在 System.Runtime.InteropServices.SafeHandle.InternalDispose()

    在 System.Runtime.InteropServices.SafeHandle.Dispose(Boolean)

    在 System.Runtime.InteropServices.SafeHandle.Dispose()

    在 System.Data.SqlClient.TdsParserStateObject.Dispose()

    在 System.Data.SqlClient.TdsParser.Disconnect()

    在 System.Data.SqlClient.SqlInternalConnectionTds.LoginFailure()

    在 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(System.Data.ProviderBase.TimeoutTimer, System.Data.SqlClient.SqlConnectionString, System.Data.SqlClient.SqlCredential, System.String, System.Security.SecureString, Boolean)

    在 System.Data.SqlClient.SqlInternalConnectionTds..ctor(System.Data.ProviderBase.DbConnectionPoolIdentity, System.Data.SqlClient.SqlConnectionString, System.Data.SqlClient.SqlCredential, System.Object, System.String, System.Security.SecureString, Boolean, System.Data.SqlClient.SqlConnectionString, System.Data.SqlClient.SessionData)

    在 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(System.Data.Common.DbConnectionOptions, System.Data.Common.DbConnectionPoolKey, System.Object, System.Data.ProviderBase.DbConnectionPool, System.Data.Common.DbConnection, System.Data.Common.DbConnectionOptions)

    在 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionPoolGroup, System.Data.Common.DbConnectionOptions)

    在 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(System.Data.Common.DbConnection, System.Threading.Tasks.TaskCompletionSource`1&lt;System.Data.ProviderBase.DbConnectionInternal&gt;, System.Data.Common.DbConnectionOptions, System.Data.ProviderBase.DbConnectionInternal, System.Data.ProviderBase.DbConnectionInternal ByRef)

    在 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionFactory, System.Threading.Tasks.TaskCompletionSource`1&lt;System.Data.ProviderBase.DbConnectionInternal&gt;, System.Data.Common.DbConnectionOptions)

    在 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionFactory, System.Threading.Tasks.TaskCompletionSource`1&lt;System.Data.ProviderBase.DbConnectionInternal&gt;, System.Data.Common.DbConnectionOptions)

    在 System.Data.SqlClient.SqlConnection.TryOpenInner(System.Threading.Tasks.TaskCompletionSource`1&lt;System.Data.ProviderBase.DbConnectionInternal&gt;)

    在 System.Data.SqlClient.SqlConnection.TryOpen(System.Threading.Tasks.TaskCompletionSource`1&lt;System.Data.ProviderBase.DbConnectionInternal&gt;)

    在 System.Data.SqlClient.SqlConnection.Open()

    在 gVariables5.[1](System.String)

    在 frmMain.(System.String, Boolean)

    在 frmMain.(DatabaseType)

    在 frmMain.œ[1](System.Object, System.EventArgs)

    在 System.Windows.Forms.ToolStripItem.RaiseEvent(System.Object, System.EventArgs)

    在 System.Windows.Forms.ToolStripMenuItem.OnClick(System.EventArgs)

    在 System.Windows.Forms.ToolStripItem.HandleClick(System.EventArgs)

    在 System.Windows.Forms.ToolStripItem.FireEventInteractive(System.EventArgs, System.Windows.Forms.ToolStripItemEventType)

    在 System.Windows.Forms.ToolStripItem.FireEvent(System.EventArgs, System.Windows.Forms.ToolStripItemEventType)

    在 System.Windows.Forms.ToolStripItem.PerformClick()

    在 frmMain.‚[1](System.Object, System.EventArgs)

    在 System.Windows.Forms.ToolStripItem.RaiseEvent(System.Object, System.EventArgs)

    在 System.Windows.Forms.ToolStripMenuItem.OnClick(System.EventArgs)

    在 System.Windows.Forms.ToolStripItem.HandleClick(System.EventArgs)

    在 System.Windows.Forms.ToolStripItem.HandleMouseUp(System.Windows.Forms.MouseEventArgs)

    在 System.Windows.Forms.ToolStripItem.FireEventInteractive(System.EventArgs, System.Windows.Forms.ToolStripItemEventType)

    在 System.Windows.Forms.ToolStripItem.FireEvent(System.EventArgs, System.Windows.Forms.ToolStripItemEventType)

    在 System.Windows.Forms.ToolStrip.OnMouseUp(System.Windows.Forms.MouseEventArgs)

    在 System.Windows.Forms.ToolStripDropDown.OnMouseUp(System.Windows.Forms.MouseEventArgs)

    在 System.Windows.Forms.Control.WmMouseUp(System.Windows.Forms.Message ByRef, System.Windows.Forms.MouseButtons, Int32)

    在 System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)

    在 System.Windows.Forms.ScrollableControl.WndProc(System.Windows.Forms.Message ByRef)

    在 System.Windows.Forms.ToolStrip.WndProc(System.Windows.Forms.Message ByRef)

    在 System.Windows.Forms.ToolStripDropDown.WndProc(System.Windows.Forms.Message ByRef)

    在 System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)

    在 System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)

    在 System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)

    在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)

    在 System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)

    在 System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)

    在 System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)

    在 System.Windows.Forms.Application.Run(System.Windows.Forms.ApplicationContext)

    在 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()

    在 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()

    在 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(System.String[])

    在 ..(System.String[])

    </Data></EventData></Event>

    作为付费用户,当然和作者邮件确认,最后发现是.NET Framework 4.5.1的问题,升级4.5.2后解决。具体解释可参考此网页

    在安装了 Microsoft Visual Studio 2013或 Microsoft.NET Framework 4.5.1 的计算机上,使用 System.Data.SqlClient 通过 TCP 端口连接 SQL Server 会导致应用程序崩溃。另外,应用程序引发System.AccessViolationException异常。
    注意:当应用程序遇到了此问题时,创建不同的调用堆栈。下面的示例演示这种情况下的典型调用堆栈模式。

  • 相关阅读:
    Go 工作空间 深度解析
    go语言中获取变量类型的三种方法
    go语言实现分布式对象存储系统之单体对象存储
    curl命令用法
    删除Git服务器文件但是保留本地文件
    pycharm之gitignore设置
    通过pycharm使用git
    python 有关datetime时间日期 以及时间戳转换
    Please, commit your changes or stash them before you can merge
    jinkins配置python虚拟环境
  • 原文地址:https://www.cnblogs.com/zhangronghua/p/4574335.html
Copyright © 2020-2023  润新知