在app.config中添加“gcServer”配置设置后,Windows服务无法启动

时间:2011-08-03 17:40:04

标签: windows service

因为我们在Windows服务应用程序的生产服务器上获取了OutOfMemory Exceptions。我们正在尝试在服务app.config中添加“gcServer”设置。问题是,添加此配置设置后,我们无法启动服务。

配置设置

<Configuration>
  <runtime>
    <gcServer enabled="true" />
  </runtime>
</Configuration>

以下所有链接都建议对非交互式Microsoft .NET Windows服务器应用程序进行此更改:

http://support.microsoft.com/default.aspx?scid=kb;en-us;840523
http://msdn.microsoft.com/en-us/library/ff647790.aspx
http://blogs.msdn.com/b/junfeng/archive/2004/07/13/181534.aspx
http://stackoverflow.com/questions/794415/experience-using-gcserver-true-to-set-garbage-collector-for-net

以下是记录到事件查看器中的错误。任何人都可以帮助我们解决这个问题。

应用程序错误

Faulting application name: Myapp.exe, version: 1.0.0.0, time stamp: 0x4e395587
Faulting module name: KERNELBASE.dll, version: 6.1.7601.17514, time stamp: 0x4ce7c78c
Exception code: 0xe0434352
Fault offset: 0x000000000000a49d
Faulting process id: 0xd90
Faulting application start time: 0x01cc51e6907b6880
Faulting application path: D:\Users\xxx\Projects\Myapp\bin\Debug\Myapp.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report Id: ce3178ef-bdd9-11e0-8de9-7071bcbcc063

.NET Runtime

Application: Myapp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Configuration.ConfigurationErrorsException
Stack:
   at System.Configuration.ClientConfigurationSystem.EnsureInit(System.String)
   at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(System.String)
   at System.Configuration.ConfigurationManager.get_AppSettings()
   at Myapp..ctor()
   at Myapp.Program.Main()

1 个答案:

答案 0 :(得分:1)

将配置元素节点名称上的大小写更改为全部小写:

<configuration>
  <runtime>
    <gcServer enabled="true" />
  </runtime>
</configuration>