首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在windows7上加载时,ODBC出现VB.NET表单问题。拒绝访问net framework文件夹

在windows7上加载时,ODBC出现VB.NET表单问题。拒绝访问net framework文件夹
EN

Stack Overflow用户
提问于 2017-04-12 15:48:41
回答 2查看 60关注 0票数 0

我是vb.net新手..我们最近创建了一个表单,它在连接到iSeries之后加载列表。该表单在Win8上的运行情况与预期一致,也已与XPs进行了核对,并且工作正常。我正在编译该文件,并将.exe放到某个文件夹中,然后从该文件夹(即C:\My Programs\VB_Apps)运行应用程序。在编译过程中,我使用了any_cpu/x86/x64选项,也遇到了同样的问题。应用程序正在建立一个使用ODBC驱动程序的连接(也尝试了OleDB驱动程序,但也遇到了同样的问题)。当从iSeries调用应用程序时,窗口正在加载,但在连接时应用程序停止,并收到以下消息:

代码语言:javascript
复制
************** 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).`

此错误在x64和x86计算机上都会发生。得到错误的机器的唯一共同特征是都使用win7。

有没有人之前遇到过类似的情况,或者知道我可能会做错什么?

EN

回答 2

Stack Overflow用户

发布于 2017-04-12 15:58:42

尝试检查运行应用程序的用户是否有权访问路径。

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config

将权限分配给用户。

票数 0
EN

Stack Overflow用户

发布于 2017-04-14 21:20:51

用户有权限,我意识到的另一件事是,通过将或当前驱动程序从客户端访问odbc更改为iseries odbc,win7 x64起作用了。所有安装了win7 x32的电脑都不能工作。我认为我们需要用win8或更新的版本替换所有的win7,但这仍然是一个令我担心的问题,因为我没有一个给定的解决方案,以便信任我的应用程序可以在生产环境中工作。

到目前为止,提前感谢你

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43363449

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档