Azure: {“目录路径” 参数名称的语法无效:初始配置“} 错误

本文关键字:语法 无效 配置 错误 参数 路径 目录路径 Azure | 更新日期: 2023-09-27 18:30:48

我正在尝试将日志文件添加到 blob 存储。当尝试在 Global.asax 中获取连接字符串时.cs我从面向这里收到此错误:

DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", diagnostics);

我该如何解决这个问题。"Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString"在ServiceConfiguration.Cloud.cscfg和ServiceConfiguration.Local.cscfg中

给出更多解释:

System.ArgumentOutOfRangeException was unhandled
  HResult=-2146233086
  Message=Invalid syntax for directory path ''
Parameter name: initialConfiguration
  Source=Microsoft.WindowsAzure.Diagnostics
  ParamName=initialConfiguration
  StackTrace:
       at Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorConfiguration.Validate(String paramName, Nullable`1 resourceSize)
       at Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.StartWithExplicitConfiguration(DiagnosticMonitorStartupInfo startupInfo, DiagnosticMonitorConfiguration initialConfiguration)
       at Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.Start(CloudStorageAccount storageAccount, DiagnosticMonitorConfiguration initialConfiguration)
       at Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.Start(String diagnosticsStorageAccountConfigurationSettingName, DiagnosticMonitorConfiguration initialConfiguration)
       at Project.Web.WebRole.OnStart() in Global.asax.cs:line 104
       at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum)
       at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRole(RoleType roleType)
       at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.<InitializeRole>b__0()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

Azure: {“目录路径”
参数名称的语法无效:初始配置“} 错误

看起来您正在正确检索连接字符串,但诊断配置无效。 您为目录配置设置了什么?

与其通过代码设置诊断配置,我建议使用 wadcfg 文件 (http://msdn.microsoft.com/en-us/library/windowsazure/hh411551.aspx),或使用 Visual Studio(请参阅 http://weblogs.asp.net/scottgu/archive/2013/04/30/announcing-the-release-of-windows-azure-sdk-2-0-for-net.aspx,特别是"云服务:改进的诊断支持"部分)。