本文介绍了{"无法收到错误消息(161)(0)。"} ??在TransactionScope中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 嗨。 我无法打开TransactionScope中的Oracle连接。 Oracle服务器安装在Windows 2003 SP2机器中。 在我的客户端我正在使用Windows 7操作系统和.Net 3.5。我已经安装了OracleClient .. 我正在尝试连接到Server,但我无法打开Connection。 代码: // SecurityConnectionString = Data Source = TestDB; Persist Security Info = True; User ID = TEST $ SECURITY; Password = TESTSECURITY; Unicode = True using(System.Transactions.TransactionScope transaction = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required)) { using(OracleConnection Con = new OracleConnection(SecurityConnectionString)) { if(Con.State == ConnectionState.Closed) Con.Open(); //未处理的Oracle异常发生在这里 //我的程序逻辑在这里 } } 即使我已经更改了Microsoft Distributed Transaction Cordinator设置。 即DTC-> Security->网络DTC访问已启用。  但我仍有问题。 相同代码适用于Windows XP SP1.但不适用于Windows 7。 我得到的实际错误是  System.Data.OracleClient.OracleException:{" \0"} 代码= 161 Source = System.Data.OracleClient; StackTrace ="  at System.Data。 System.Data.OracleClient.OracleInternalConnection.Enlist(String userName,String password,String serverName,Transaction transaction,Boolean manualEnlistment)中的OracleClient.OciEnlistContext.Join(OracleInternalConnection internalConnection,Transaction indigoTransaction)\\ nn; \\ n在System.Data.OracleClient.OracleInternalConnection.Activate(事务处理)\\ nn;在System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(事务处理)\ r \\ n  在System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)\\ nn;在System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnec)在System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection,DbConnectionFactory connectionFactory)\\\\ n 在System.Data.OracleClient.OracleConnection.Open()\\\\ n 位于C:\\Users \\sagar \\Desktop \\UDTOOL 1.0 \\UDTOOL 1.0 \\LoginForm中的UDTOOL_1._0.LoginForm.btnLogin_Click(Object sender,EventArgs e) .cs:行 196 \\ n 在System.Windows.Forms.Control.OnClick(EventArgs e)\\\\ n 在System.Windows.Forms.Button.OnClick(EventArgs e)\\\\ n 在System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)\\\\ n 在System.Windows.Forms.Control.WmMouseUp(消息& m,MouseButtons按钮,Int32点击)\\\\ n 在System.Windows.Forms.Control.WndProc(消息& m)\\\\ n 在System.Windows.Forms.ButtonBase.WndProc(消息& m)\\\\ n 在System.Windows.Forms.Button.WndProc(消息& m)\\\\ n 在System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息& m)\\\\ n 在System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\\\\ n 在System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam)\\\\ n 在System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)\\\\ n 在System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID,Int32 reason,Int32 pvLoopData)\\\\ n 在System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason,ApplicationContext context)\\\\ n 在System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,ApplicationContext context)\\\\ n 在System.Windows.Forms.Application.Run(Form mainForm)\\\\ n  at UDTOOL_1._0.Program.Main() in C:\\Users \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ cs:第29行\\ n \ n \\ n  at System.AppDomain._nExecuteAssembly(Assembly assembly,String [] args)\\\\ n  at System.AppDomain.ExecuteAssembly(String assemblyFile,Evidence assemblySecurity,String [] args)\\\\ n 在Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\\\\ n 在System.Threading.ThreadHelper.ThreadStart_Context(对象状态)\\\\ n 在System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state)\\\\ n 在System.Threading.ThreadHelper.ThreadStart()" 请帮助.. .... 解决方案 您的应用是否在Windows 7上运行64位? Hi.i am unable to open Oracle connection inside TransactionScope.Oracle server is installed in Windows 2003 SP2 Machine.In My client Place i am using Windows 7 OS and .Net 3.5.and i have installed OracleClient ..I am trying to connect to Server but i am unable to open Connection.Code ://SecurityConnectionString=Data Source=TestDB;Persist Security Info=True;User ID=TEST$SECURITY;Password=TESTSECURITY;Unicode=Trueusing (System.Transactions.TransactionScope transaction = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required)){using (OracleConnection Con = new OracleConnection(SecurityConnectionString)){if (Con.State == ConnectionState.Closed)Con.Open(); //Unhandled Oracle Exception Occurs Here//Here My Program Logic Goes}}Even i have changed Microsoft Distributed Transaction Cordinator Settings.i.e DTC->Security->Network DTC access Enabled. But still i have problem.Same Code is working on Windows XP SP1.but not on Windows 7.Actual Error i am getting is System.Data.OracleClient.OracleException : {"\0"}Code=161Source=System.Data.OracleClient;StackTrace="   at System.Data.OracleClient.OciEnlistContext.Join(OracleInternalConnection internalConnection, Transaction indigoTransaction)\r\n   at System.Data.OracleClient.OracleInternalConnection.Enlist(String userName, String password, String serverName, Transaction transaction, Boolean manualEnlistment)\r\n   at System.Data.OracleClient.OracleInternalConnection.Activate(Transaction transaction)\r\n   at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction)\r\n   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)\r\n   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)\r\n   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)\r\n   at System.Data.OracleClient.OracleConnection.Open()\r\n   at UDTOOL_1._0.LoginForm.btnLogin_Click(Object sender, EventArgs e) in C:\\Users\\sagar\\Desktop\\UDTOOL 1.0\\UDTOOL 1.0\\LoginForm.cs:line 196\r\n   at System.Windows.Forms.Control.OnClick(EventArgs e)\r\n   at System.Windows.Forms.Button.OnClick(EventArgs e)\r\n   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)\r\n   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)\r\n   at System.Windows.Forms.Control.WndProc(Message& m)\r\n   at System.Windows.Forms.ButtonBase.WndProc(Message& m)\r\n   at System.Windows.Forms.Button.WndProc(Message& m)\r\n   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\r\n   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\r\n   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)\r\n   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)\r\n   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n   at System.Windows.Forms.Application.Run(Form mainForm)\r\n   at UDTOOL_1._0.Program.Main() in C:\\Users\\sagar\\Desktop\\UDTOOL 1.0\\UDTOOL 1.0\\Program.cs:line 29\r\n   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n   at System.Threading.ThreadHelper.ThreadStart()"Please Help...... 解决方案 Is your app running 64-bit on Windows 7? 这篇关于{"无法收到错误消息(161)(0)。"} ??在TransactionScope中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-19 02:56