.NET应用程序在一台PC上崩溃,无法解决的异常

Bob*_*bby 6 .net exception .net-2.0

我有一个没有任何花哨的.NET 2.0应用程序.无论是安装了2.0,3.0,3.5还是3.5 SP1,无论是Win2000,XP还是Win7(总共100多台机器),它在我安装或复制到的每台 PC 上都工作到昨天.

昨天我做了正常的安装程序,想要启动它一次检查一切是否正常......但事实并非如此.该程序很难崩溃,让我没有信息"你想报告这个错误吗?" 对话.问题是Main(String[] args)我的应用程序例程中的一个例外.

事件查看器显示以下条目:

  Event Type: ErrorEvent
  Source: .NET Runtime 2.0 Error Reporting
  Event Category: None
  Event ID: 5000
  Date: 05/05/2010
  Time: 16:09:09
  User: N/A
  Computer: myClientPC
  Description:
  EventType clr20r3, P1 apomenu.exe, P2 1.4.90.53, P3 4bdedea4,
  P4 system.configuration, P5 2.0.0.0, P6 4889de74, P7 1a6, P8 136,
  P9 ioibmurhynrxkw0zxkyrvfn0boyyufow, P10 NIL.
Run Code Online (Sandbox Code Playgroud)

嗯......很棒的信息.经过大量搜索后,我终于能够获得有关此异常的更多信息(通过UnhandledExceptions直接添加处理程序My.MyApplication.New(), Application.Designer.vb):

  System.Configuration.ConfigurationErrorsException

  Configuration system failed to initialize

     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.Net.Configuration.SettingsSectionInternal.get_Section()
     at System.Net.Sockets.Socket.InitializeSockets()
     at System.Net.Sockets.Socket.get_SupportsIPv4()
     at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.get_HostName()
     at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.RegisterChannel(Boolean SecureChannel)
     at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
     at MyAppNameHere.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:Line 81.
Run Code Online (Sandbox Code Playgroud)

在这一点上,我被困住了......我没有想法.我没有使用框架中的任何配置系统(没有引用System.Configuration,并且从未生成或分发过MyAppnameHere.exe.config,也没有看过此错误).我还在微软(Google Cache)上发现了一个关于这个bug 的错误报告(在另一个背景下).但看起来,他们甚至都不会看.

非常感谢每一位帮助!

编辑:我正在使用Visual Studio 2008 Prof ..崩溃发生在客户端计算机上的Release-和Debug-Build中.直接在这台机器上调试应用程序是不可能的,我担心,300多英里,他们只有两台计算机可以使用.

Edit2:其他.NET应用程序运行正常.

编辑3:安德烈指出后,我也看了一下内部异常(我总是忘记这件事存在):

  System.Configuration.ConfigurationErrorsException

  Unknown configraution directive "system.serviceModel". (c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\machine.config line 145)

     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)
Run Code Online (Sandbox Code Playgroud)

我删除了这一部分,现在一切都正常工作......但是现在有一个问题困扰着我:为什么其他应用程序有效?

小智 6

在Windows 2008 R2机器上,我们有类似的症状.我们发现从功能安装.NET framework 3.5.1解决了我们的问题.这是两台机器之间的区别,其中一台机器正在另一架机器上工作(缺少3.5.1).


小智 3

该错误表明 .config 文件存在问题。这可能是应用程序的配置文件,也可能是 machine.config。

我建议在那台机器上卸载/重新安装 .net。


另一件要尝试的事情是查看用户是否可以以提升的身份运行您的应用程序(以管理员身份运行)。配置系统可能正在尝试访问用户无权访问的文件。如果他们可以以管理员身份运行,请找出配置系统访问哪些文件,然后指示用户允许他们的帐户权限访问这些文件。