azure - Windows Azure 诊断错误 :

标签 azure azure-diagnostics

我正在使用 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”的连接字符串。您可以在 Web 角色项目或服务配置文件的设置中更改此设置。将其设置为您的帐户名和 key 。我通常使用构建脚本来执行此操作,以便在投入生产时可以更改它。您可以查看帖子here代码 here .

关于azure - Windows Azure 诊断错误 :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5712035/

相关文章:

facebook - 将用户帐户信息存储在 Windows Azure 表上

c# - 如何在 Azure 中列出经典虚拟机

azure - 在组织中的 Office 365 上发布 Office 加载项

visual-studio - 尝试使用 Azure SDK 2.5 进行发布会导致 null-ref(对象引用未设置为对象的实例)

c# - 从作为 Azure Web App 托管的 ASP.NET 5 应用程序进行日志记录

python - Authlib 与 Azure AD - "iss"声明的声明验证错误

azure - 在不使用 .NET 的情况下在 Windows Azure 中启用诊断

c# - 诊断在 Azure SDK 2.5.1 的 Web 角色中不起作用

azure - Azure 应用程序中缺少“应用程序服务日志”选项

azure - 在隐式流的情况下是否可以在 JWT token 中包含组?