gpt4 book ai didi

c# - System.Configuration.ConfigurationException 在 Windows Server 2012 上运行基于 .NET 4.0 的服务构建时

转载 作者:可可西里 更新时间:2023-11-01 09:24:02 24 4
gpt4 key购买 nike

美好的一天。

我有一个现有的 Windows 服务,它在使用 .NET 4.0 的 Windows Service 2003 上运行良好。我正在尝试在 Windows Service 2012 上安装相同的服务并成功。但是,当我运行该服务时,出现以下错误。我相信 Windows Server 支持 4.5,其中也包括 4.0,这是正确的吗?

谁能帮我确定为什么我会收到以下消息?

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
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.PrepareClientConfigSystem(System.String)
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(System.String)
at System.Configuration.ConfigurationManager.get_AppSettings()
at ATLAS_LETTERPROCESS.SERVICE.AtlasLetterProcess..ctor()
at ATLAS_LETTERPROCESS.SERVICE.Program.Main()

事件 Xml:

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name=".NET Runtime" />
<EventID Qualifiers="0">1026</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2015-08-17T09:56:56.000000000Z" />
<EventRecordID>58020</EventRecordID>
<Channel>Application</Channel>
<Computer>usa0300vm1598.na.xerox.net</Computer>
<Security />
</System>
<EventData>
<Data>Application: ATLAS_LETTERPROCESS.SERVICE.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.PrepareClientConfigSystem(System.String)
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(System.String)
at System.Configuration.ConfigurationManager.get_AppSettings()
at ATLAS_LETTERPROCESS.SERVICE.AtlasLetterProcess..ctor()
at ATLAS_LETTERPROCESS.SERVICE.Program.Main()
</Data>
</EventData>
</Event>

下面是当前的app.config文件

<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="ATLAS_LETTERPROCESS.Common.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<connectionStrings>
<add name="Intentionally Hidden" connectionString="metadata=res://*/AtlasLetterProcess.csdl|res://*/AtlasLetterProcess.ssdl|res://*/AtlasLetterProcess.msl;provider=Oracle.DataAccess.Client;provider connection string=&quot;DATA SOURCE=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = Intentionally Hidden)(PORT = Intentionally Hidden))) (CONNECT_DATA = (SERVICE_NAME = Intentionally Hidden)));User Id= Intentionally Hidden;Password=Intentionally Hidden;&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>
<oracle.dataaccess.client>
<settings>

<add name="Intentionally Hidden" value="implicitRefCursor bindinfo='mode=Output'"/>

<add name="Intentionally Hidden" value="implicitRefCursor metadata='ColumnName=TL_LETTER_ID;
BaseColumnName=TL_LETTER_ID; BaseSchemaName=CMS_USER;BaseTableName=TBL_LETTER;
NativeDataType=number;ProviderType=Int32'"/>

<add name="Intentionally Hidden" value="implicitRefCursor metadata='ColumnName=TL_ATLAS_KEY_ID;
BaseSchemaName=CMS_USER;BaseTableName=TBL_LETTER;NativeDataType=varchar2;ProviderType=varchar2;ProviderDBType=String;
DataType=System.String;AllowDBNull=true'"/>

<add name="Intentionally Hidden" value="implicitRefCursor metadata='ColumnName=TL_INPUT_XML;
BaseSchemaName=CMS_USER;BaseTableName=TBL_LETTER;
NativeDataType=clob;ProviderType=Clob'"/>

<add name="Intentionally Hidden" value="implicitRefCursor metadata='ColumnName=TL_DART_URL;BaseSchemaName=CMS_USER;
BaseTableName=TBL_LETTER;NativeDataType=varchar2;ProviderType=Varchar2;ProviderDBType=String;
DataType=System.String;AllowDBNull=true'"/>

<add name="Intentionally Hidden" value="implicitRefCursor metadata='ColumnName=TL_STATUS;BaseSchemaName=CMS_USER;
BaseTableName=TBL_LETTER;NativeDataType=char;ProviderType=char;ProviderDBType=String;ColumnSize=2;
DataType=System.String;AllowDBNull=true'"/>

<add name="Intentionally Hidden" value="implicitRefCursor metadata='ColumnName=TL_TYPE;
BaseSchemaName=CMS_USER;BaseTableName=TBL_LETTER;NativeDataType=varchar2;ProviderType=varchar2;ProviderDBType=String;
DataType=System.String;AllowDBNull=true'"/>

<add name="Intentionally Hidden" value="implicitRefCursor metadata='ColumnName=TL_MODE;BaseSchemaName=CMS_USER;
BaseTableName=TBL_LETTER;NativeDataType=char;ProviderType=char;ProviderDBType=String;ColumnSize=1;
DataType=System.String;AllowDBNull=true'"/>

<add name="Intentionally Hidden" value="implicitRefCursor metadata='ColumnName=TL_REMARKS;BaseSchemaName=CMS_USER;
BaseTableName=TBL_LETTER;NativeDataType=varchar2;ProviderType=varchar2;ProviderDBType=String;ColumnSize=2000;
DataType=System.String;AllowDBNull=true'"/>

<add name="Intentionally Hidden" value="implicitRefCursor metadata='ColumnName=TL_TASK_ID;BaseSchemaName=CMS_USER;
BaseTableName=TBL_LETTER;NativeDataType=varchar2;ProviderType=varchar2;ProviderDBType=String;ColumnSize=50;
DataType=System.String;AllowDBNull=true'"/>

<add name="Intentionally Hidden" value="implicitRefCursor metadata='ColumnName=TEMPLATE_NAME;BaseSchemaName=CMS_USER;
BaseTableName=TBL_LETTER;NativeDataType=varchar2;ProviderType=varchar2;ProviderDBType=String;ColumnSize=100;
DataType=System.String;AllowDBNull=true'"/>

<add name="Intentionally Hidden" value="implicitRefCursor metadata='ColumnName=TEMPLATE_PATH;BaseSchemaName=CMS_USER;
BaseTableName=TBL_LETTER;NativeDataType=varchar2;ProviderType=varchar2;ProviderDBType=String;ColumnSize=2000;
DataType=System.String;AllowDBNull=true'"/>

<add name="Intentionally Hidden" value="implicitRefCursor metadata='ColumnName=PULL_DART_INVOICE;BaseSchemaName=CMS_USER;
BaseTableName=TBL_LETTER;NativeDataType=varchar2;ProviderType=char;ProviderDBType=String;ColumnSize=1;
DataType=System.String;AllowDBNull=true'"/>

<add name="Intentionally Hidden" value="implicitRefCursor metadata='ColumnName=DESCRIPTION;BaseSchemaName=CMS_USER;
BaseTableName=TBL_LETTER;NativeDataType=varchar2;ProviderType=varchar2;ProviderDBType=String;ColumnSize=100;
DataType=System.String;AllowDBNull=true'"/>

<add name="Intentionally Hidden" value="implicitRefCursor metadata='ColumnName=TEMPLATE_IDENTIFIER_TYPE;BaseSchemaName=CMS_USER;
BaseTableName=TBL_LETTER;NativeDataType=varchar2;ProviderType=varchar2;ProviderDBType=String;ColumnSize=100;
DataType=System.String;AllowDBNull=true'"/>
</settings>
</oracle.dataaccess.client>
<appSettings>

<add key="CCLLetterPath" value="D:\Atlas_Collection_Services\AtlasLetterProcess\Output\CCLLetters\"/>
<add key="AutoLetterPath" value="D:\Atlas_Collection_Services\AtlasLetterProcess\Output\AutoLetters\"/>
<add key="OnDemandPath" value="D:\Atlas_Collection_Services\AtlasLetterProcess\Output\OnDemandLetters\"/>
<add key="AutoStopPath" value="D:\Atlas_Collection_Services\AtlasLetterProcess\Output\AutoStopLetters\"/>
<add key="XSDPath" value="D:\Atlas_Collection_Services\AtlasLetterProcess\XSD\LetterProcess.xsd"/>
<add key="LogFilePath" value="D:\Atlas_Collection_Services\AtlasLetterProcess\Log\"/>
<add key="LogFileName" value="ATLAS_LETTERPROCESS"/>
<add key="HeaderImage" value="D:\Atlas_Collection_Services\AtlasLetterProcess\Header.jpg"/>
<add key="DeleteFiles" value="Y"/>
<add key="ArchivePath" value="D:\Atlas_Collection_Services\AtlasLetterProcess\Archive\"/>
<!-- Print Center Configurations-->
<add key="ServerAddress" value="Intentionally Hidden" />
<add key="UserName" value="Intentionally Hidden" />
<add key="Password" value="Intentionally Hidden" />
<add key="LicenseKey" value="Intentionally Hidden" />
<add key="LicenseOwner" value="Intentionally Hidden" />
<add key="ChangeWorkingDirectory" value="/collectltr/Prod/" />
<add key="ServerPort" value="22" />
<!--Email Details-->
<add key="SMTPServer" value="Intentionally Hidden" />
<add key="EmailSupportFrom" value="AtlasLetterProcessProd@Intentionally Hidden"/>
<add key="EmailSupportTo" value="Intentionally Hidden@Intentionally Hidden"/>
<add key="EmailSupportCC" value=""/>
<add key="EmailSupportBCC" value=""/>
<add key="EmailSubject" value="Atlas LetterProcess(Prod): Error in letter process service."/>
<add key ="ErrorStartLine" value = "****************** Error Message ******************" />
<add key ="EndLine" value = "***************************************************" />
<!--ATLAS-->
<add key="AtlasUsername" value="Intentionally Hidden" />
<add key="AtlasPassword" value="Intentionally Hidden" />
<add key="AtlasSessionType" value="Stateless" />
<add key="AtlasExpirationHours" value="10" />
<add key="AtalasServiceURL" value="http://Intentionally Hidden:8080/eai_enu/start.swe?SWEExtSource=WebService&amp;SWEExtCmd=Execute&amp;WSSOAP=1"/>
<!--Service Timing-->
<add key="AutoMode" value="ON" />
<add key="ServiceStartTime" value="01:00" />
<add key="ServiceEndTime" value="23:00" />
<add key="ServiceInterval" value="60000" />
<add key="ServiceDay" value="1,2,3,4,5,6,0" />
<!--Mon-1,Tue-2,Wed-3,Thr-4,Fri-5,Sat-6,Sun-0-->
<!--Dart Service configurations-->
<add key="DARTServiceURL" value="Intentionally Hidden"/>
<add key="DartUsername" value="Intentionally Hidden"/>
<add key="DartPassword" value="Intentionally Hidden"/>
<add key="PartitionLimit" value="1000" />
<add key="ExcludeInvoiceCodes" value="78,79,RD,TD,SD" />

</appSettings>
<applicationSettings>
<ATLAS_LETTERPROCESS.Common.Properties.Settings>
<setting name="ATLAS_LETTERPROCESS_Common_DARTWebService_DARTWebServiceService"
serializeAs="String">
<value>Intentionally Hidden</value>
</setting>
</ATLAS_LETTERPROCESS.Common.Properties.Settings>
</applicationSettings>
<system.web>
<webServices>
<soapExtensionTypes>
<add type="ATLAS_LETTERPROCESS.SoapExtension.SiebelSoapExtension, ATLAS_LETTERPROCESS.SoapExtension" />
</soapExtensionTypes>
</webServices>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>

最佳答案

我能够使用一个简单的控制台应用程序并使用您在其中作为 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. 

这可能非常好,因为我没有安装正确的组件,但配置部分没有指定组件并验证我注释掉了 oracle 数据访问并且它有效。我还尝试安装 oracle 托管数据访问组件,正如预期的那样,它在 web.config 的配置部分添加了配置。

配置部分缺少 Oracle 数据访问配置。例如下面是 oracle 管理的数据访问 -

<configSections>

<section name="oracle.manageddataaccess.client"

type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />

</configSections>

关于c# - System.Configuration.ConfigurationException 在 Windows Server 2012 上运行基于 .NET 4.0 的服务构建时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32194018/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com