Windows Azure诊断错误:

Windows Azure诊断错误:,azure,azure-diagnostics,Azure,Azure Diagnostics,我正在使用Windows Azure诊断。我在Webrol.cs中添加了以下代码 试一试 以及Web.config中剩余的必需内容和.cscfg文件中的连接字符串。 现在,我可以使用部署存储从开发环境将诊断记录到中。但当我在云中托管相同的应用程序时,我无法记录诊断。我得到了一个错误,就像 “500-内部服务器错误。 您正在查找的资源有问题,无法显示。“ 我尝试将名称空间的Copy local更改为true,但这不起作用。 我希望应用程序在部署环境中工作。 如果有人有任何想法来解决这个问题,请回复

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

试一试

以及Web.config中剩余的必需内容和.cscfg文件中的连接字符串。 现在,我可以使用部署存储从开发环境将诊断记录到中。但当我在云中托管相同的应用程序时,我无法记录诊断。我得到了一个错误,就像

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

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


提前感谢。

问题似乎是您没有更改“Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString”的连接字符串。您可以在web角色项目或服务配置文件的设置中对此进行更改。将其设置为您的帐户名和密钥。我通常用一个构建脚本来实现这一点,这样我可以在投入生产时更改它。您可以查看帖子和代码。

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

            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");



        }