我有一个WebRole和2个ServiceBus WorkerRoles正在运行,在角色的OnStart期间,我得到以下内容 例外: [System.ArgumentOutOfRangeException]容器log4net的语法无效参数名称:initialConfiguration
Running Azure:
ConfigurationManager version=1.7.0.3
ServiceBus version=1.7.0.1
Storage version=1.7.0.0
在开发Azure环境和云中本地运行时会发生这种情况。所有角色都具有以下Configurtion设置:
<LocalStorage name="Log4Net" cleanOnRoleRecycle="true" sizeInMB="2048" />
所有角色在OnStart中都有以下代码:
try
{
// Configure Diagnostics to poll Log file to Blob Storage
var diagnosticsConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();
diagnosticsConfig.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(5);
diagnosticsConfig.Directories.DataSources.Add(
new DirectoryConfiguration
{
Path = RoleEnvironment.GetLocalResource("Log4Net").RootPath,
DirectoryQuotaInMB = 512,
Container = "wad-WebRolelog4net"
});
DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", diagnosticsConfig);
}
catch
{
OnStop();
return false;
}
堆栈追踪:
at Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorConfiguration.Validate(String paramName,Nullable`1 resourceSize) 在Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.StartWithExplicitConfiguration(DiagnosticMonitorStartupInfo startupInfo,DiagnosticMonitorConfiguration initialConfiguration) 在Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.Start(CloudStorageAccount storageAccount,DiagnosticMonitorConfiguration initialConfiguration) 在Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.Start(String diagnosticsStorageAccountConfigurationSettingName,DiagnosticMonitorConfiguration initialConfiguration) 在c:\ Projects \ Client \ Connection中的CICRMIntegrationQueue.WorkerRole.OnStart()处理Intelegence \ CICloud \ CICRMIntegrationQueue \ WorkerRole.cs:第193行
当我在所有3个角色中都有本地存储和DiagnosticMonitor
轮询时,似乎会发生此错误,当只定义了一个角色时,不会发生错误。