【问题标题】:Windows Azure Diagnostics Error:Windows Azure 诊断错误:
【发布时间】:2011-05-05 10:47:12
【问题描述】:

我正在使用 Windows Azure 诊断程序。我在 Webrol.cs 中添加以下代码

试试

        {

            string wadConnectionString = "Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString";

            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue(wadConnectionString));



            RoleInstanceDiagnosticManager roleInstanceDiagnosticManager = storageAccount.CreateRoleInstanceDiagnosticManager(RoleEnvironment.DeploymentId, RoleEnvironment.CurrentRoleInstance.Role.Name, RoleEnvironment.CurrentRoleInstance.Id);

            DiagnosticMonitorConfiguration config = DiagnosticMonitor.GetDefaultInitialConfiguration();



            //Windows Azure logs

            config.Logs.ScheduledTransferPeriod = TimeSpan.FromMinutes(1D);

            config.Logs.ScheduledTransferLogLevelFilter = LogLevel.Undefined;



            //IIS 7.0 logs

            config.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1D);



            ////Failed Request logs

            config.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1D);



            //Windows Event logs

            // config.WindowsEventLog.DataSources.Add("System!*");

            config.WindowsEventLog.DataSources.Add("Application!*");

            config.WindowsEventLog.ScheduledTransferPeriod = TimeSpan.FromMinutes(1D);



            ////Crash dumps

            CrashDumps.EnableCollection(true);





            //update the config with changes

            roleInstanceDiagnosticManager.SetCurrentConfiguration(config);

        }

        catch (Exception ee)

        {

            System.Diagnostics.Trace.TraceWarning("Diagnostics failed");



        }

以及 Web.config 中剩余的必要内容以及 .cscfg 文件中的连接字符串。 现在我可以使用部署存储在开发环境中记录诊断。但是当我在云中托管相同的应用程序时,我无法记录诊断。我收到类似的错误

"500 - 内部服务器错误。 您要查找的资源有问题,无法显示。”

我尝试将命名空间的 Copy local 更改为 true,但这不起作用。 我希望应用程序在部署环境中工作。 如果有人有任何解决此问题的想法,请回复我。

提前致谢。

【问题讨论】:

  • 部署到云端时,您是否将“Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString”的值设置为实际存储帐户的连接字符串?

标签: azure azure-diagnostics


【解决方案1】:

您似乎没有更改“Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString”的连接字符串。您可以在 Web 角色项目或服务配置文件的设置中更改此设置。将其设置为您的帐户名称和密钥。我通常使用构建脚本来执行此操作,因此当我推送到生产环境时可以更改它。您可以查看帖子here和代码here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多