C# 在应用程序设置上调用Upgrade()时ArgumentNullException

C# 在应用程序设置上调用Upgrade()时ArgumentNullException,c#,.net-3.5,application-settings,C#,.net 3.5,Application Settings,我有一个windows服务,它使用用户范围设置,并在服务启动期间使用以下代码加载这些设置: Properties.Settings.Default.Reload(); if (Properties.Settings.Default.UpgradeRequired) { Properties.Settings.Default.Upgrade(); Properties.Settings.Default.UpgradeRequired = false; } 在一台生产机器上,服务无法启动,

我有一个windows服务,它使用用户范围设置,并在服务启动期间使用以下代码加载这些设置:

Properties.Settings.Default.Reload();
if (Properties.Settings.Default.UpgradeRequired)
{
  Properties.Settings.Default.Upgrade();
  Properties.Settings.Default.UpgradeRequired = false;
}
在一台生产机器上,服务无法启动,我从
Reload()
方法中获得一个
ArgumentNullException
,具有以下堆栈跟踪:

System.ArgumentNullException: Value cannot be null.
Parameter name: path
  at System.IO.Directory.GetParent(String path)
  at System.Configuration.LocalFileSettingsProvider.GetPreviousConfigFileName(Boolean isRoaming)
  at System.Configuration.LocalFileSettingsProvider.Upgrade(SettingsContext context, SettingsPropertyCollection properties, Boolean isRoaming)
  at System.Configuration.LocalFileSettingsProvider.Upgrade(SettingsContext context, SettingsPropertyCollection properties)
  at System.Configuration.ApplicationSettingsBase.Upgrade()

没有文档证明
Upgrade()
方法会引发
ArgumentNullException
。有人知道这意味着什么和/或我如何在不重建服务的情况下解决它吗?

这是一种什么样的应用程序?我只在“单击一次”部署的windows窗体应用程序中使用过它,它对我来说非常有用。您是从日志文件或事件查看器中获得此异常的吗?@RossDargan它是一个windows服务,使用由来自的标准安装项目创建的msi安装的VS2008@DJ,我在AppDomain.CurrentDomain.UnhandledException事件处理程序中发现了此问题,并将其记录到windows事件日志中。看起来它正在尝试访问不存在的配置文件。