简体   繁体   English

在Windows7上加载时,ODBC的VB.NET表单问题。 拒绝访问网络框架文件夹

[英]VB.NET form issue with ODBC when loading on windows7. Access to net framework folder denied

I'm new to vb.net.. We recently created a form which loads lists after connecting to our IBM iSeries Server. 我是vb.net的新手。.我们最近创建了一个表单,该表单在连接到我们的IBM iSeries Server之后加载列表。 The Form is working as intended on Win8 and also checked with XPs and working too. 该表格可以在Win8上正常工作,并且可以与XP一起检查,并且也可以正常工作。 I'm compiling the file and getting the .exe to a certain folder and running the app from this folder (ie C:\\My Programs\\VB_Apps). 我正在编译文件,并将.exe放入某个文件夹,然后从该文件夹运行应用程序(即C:\\ My Programs \\ VB_Apps)。 During compilation I used the any_cpu/x86/x64 options and also had the same problem. 在编译期间,我使用了any_cpu / x86 / x64选项,并且也遇到了同样的问题。 The app is making a connection that uses the ODBC driver (also tried OleDB driver and had the same issues). 该应用程序正在建立使用ODBC驱动程序的连接(也尝试过OleDB驱动程序,并且存在相同的问题)。 When the app is called from iSeries the window is getting load, but at the time of connection the App stops and getting the following message: 从iSeries调用该应用程序时,窗口正在加载,但是在连接时,该应用程序停止并收到以下消息:

************** Exception Text **************
System.TypeInitializationException: The type initializer for 'System.Transactions.Diagnostics.DiagnosticTrace' threw an exception. ---> System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Access to the path 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config' is denied. (C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config) ---> System.UnauthorizedAccessException: Access to the path 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at System.Configuration.Internal.InternalConfigHost.StaticOpenStreamForRead(String streamName)
   at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String streamName, Boolean assertPermissions)
   at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String streamName)
   at System.Configuration.ClientConfigurationHost.OpenStreamForRead(String streamName)
   at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()
   --- End of inner exception stack trace ---

   at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
   at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
   at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
   at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
   --- End of inner exception stack trace ---

   at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
   at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName)
   at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
   at System.Configuration.ConfigurationManager.GetSection(String sectionName)
   at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
   at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection()
   at System.Diagnostics.DiagnosticsConfiguration.Initialize()
   at System.Diagnostics.DiagnosticsConfiguration.get_Sources()
   at System.Diagnostics.TraceSource.Initialize()
   at System.Diagnostics.TraceSource.get_Switch()
   at System.Transactions.Diagnostics.DiagnosticTrace..cctor()
   --- End of inner exception stack trace ---

   at System.Transactions.Transaction.get_Current()
   at System.Data.Common.ADP.IsSysTxEqualSysEsTransaction()
   at System.Data.Common.ADP.NeedManualEnlistment()
   at System.Data.Odbc.OdbcConnection.Open()
   at app1.Form1.SQLAS_header()
   at app1.Form1.Form1_Load(Object sender, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam).`

This error occurs on both x64 & x86 machines. 在x64和x86机器上均会发生此错误。 The only common characteristic of the machines that getting the error is that all using win7. 出现错误的计算机的唯一共同特征是全部使用win7。

Does anyone faced anything similar before or knows what i might doing wrong? 有人以前遇到过类似的事情吗,或者知道我可能做错了什么?

Try to check the user running application has access to path. 尝试检查运行应用程序的用户是否有权访问路径。

C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\Config\\machine.config C:\\ WINDOWS \\ Microsoft.NET \\框架\\ v4.0.30319 \\ CONFIG \\ machine.config中

Assign Permissions to User. 向用户分配权限。

User has persmisions, another thing I realized is that by changing the or current driver from client access odbc to iseries odbc the win7 x64 worked. 用户充满了好奇心,我意识到的另一件事是,通过将客户端访问odbc或当前驱动程序更改为iseries odbc,win7 x64起作用了。 All those computers with win7 x32 still not working. 所有带有win7 x32的计算机仍然无法正常工作。 I think we need to replace all the win7 with win8 or newer, but still this will be an issue that worries me since I don't have a given solution so as to trust my app to wok in production environment.. 我认为我们需要用win8或更高版本替换所有的win7,但这仍然是一个令我担忧的问题,因为我没有给定的解决方案来信任我的应用程序在生产环境中可以正常工作。

Thanks so far and in advance 到目前为止谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM