C# 在Windows Server 2012上运行基于.NET 4.0的服务构建时System.Configuration.ConfigurationException
你好 我有一个现有的windows服务,它在windows service 2003上使用或.NET 4.0运行良好。我正在尝试在Windows service 2012上安装相同的服务,并已成功。然而,当我运行服务时,我得到了下面的错误。我相信Windows Server支持4.5,其中也包括4.0,对吗 有人能帮我确定为什么我会收到下面的信息吗C# 在Windows Server 2012上运行基于.NET 4.0的服务构建时System.Configuration.ConfigurationException,c#,asp.net,.net,windows,wcf,C#,Asp.net,.net,Windows,Wcf,你好 我有一个现有的windows服务,它在windows service 2003上使用或.NET 4.0运行良好。我正在尝试在Windows service 2012上安装相同的服务,并已成功。然而,当我运行服务时,我得到了下面的错误。我相信Windows Server支持4.5,其中也包括4.0,对吗 有人能帮我确定为什么我会收到下面的信息吗 Log Name: Application Source: .NET Runtime Date: 8/17
Log Name: Application
Source: .NET Runtime
Date: 8/17/2015 5:56:56 AM
Event ID: 1026
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: usa0300vm1598.na.xerox.net
Description:
Application: ATLAS_LETTERPROCESS.SERVICE.exe
Framework Version: v4.0.30319
事件Xml:
1026
2.
0
0x8000000000000
58020
应用
usa0300vm1598.na.xerox.net
应用程序:ATLAS_lettprocess.SERVICE.exe
框架版本:v4.0.30319
描述:由于未处理的异常,进程已终止。
异常信息:System.Configuration.ConfigurationErrorsException
堆栈:
位于System.Configuration.ClientConfigurationSystem.EnsureInit(System.String)
位于System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(System.String)
位于System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IIInternalConfigSystem.GetSection(System.String)
在System.Configuration.ConfigurationManager.get_AppSettings()中
在ATLAS_LETTERPROCESS.SERVICE.AtlasLetterProcess..ctor()上
ATLAS_lettprocess.SERVICE.Program.Main()上
下面是当前的app.config文件
故意隐瞒
我能够使用一个简单的控制台应用程序,并使用您那里的配置文件app.Config来复制这个问题
例如,在控制台应用程序中,我只有以下两行代码-
class Program
{
static void Main(string[] args)
{
var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
var abc = ConfigurationManager.AppSettings["abc"];
}
}
执行上述程序后,我得到如下所示的错误-
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.get_AppSettings()
at ExperimentConsoleApp.Program.Main(String[] args)
但是当我查看得到的内部异常时,可以看到以下错误-
Unrecognized configuration section oracle.dataaccess.client.
这可能非常好,因为我没有安装正确的组件,但是configsections没有指定组件,并且为了验证我是否注释掉了oracle数据访问,并且它可以工作。我还尝试安装oracle托管数据访问组件,正如预期的那样,它在web.config的配置部分添加了配置
配置部分缺少oracle数据访问配置。以下示例适用于oracle托管数据访问-
您的app.config文件中有错误如何显示您的exe.config文件(appSettings部分)我已从app.config添加了内容(注意:某些值是故意隐藏的)有关此问题的任何帮助?感谢使用此测试方法帮助我解决了另一个与app.config相关的问题。
Unrecognized configuration section oracle.dataaccess.client.