首页 文章

启用Azure PaaS Diagnostics sdk 2.8

提问于
浏览
0

尝试在azure中启用工作者角色的paas诊断这是我尝试过的:1 . 在VS2015中,右键单击角色并启用诊断 . 结果:1分钟后超时 . 多次尝试过 . 2.使用powershell启用:

$storage_name = "mystorageaccount"
$key = "typedstoragekeyhere"
$publicconfigpath = "C:\Temp\diagnostics.wadcfgx"
$servicename = "cloudservicename"
$storageContext = New-AzureStorageContext -StorageAccountName $storage_name -StorageAccountKey $key
Set-AzureServiceDiagnosticsExtension -StorageContext $storageContext -DiagnosticsConfigurationPath $publicconfigpath -ServiceName $servicename -Slot Production

结果:Set-AzureServiceDiagnosticsExtension:BadRequest:扩展公共配置......对于模式后跟无效

在底部:CategoryInfo:NotSpecified:(:) [Set-AzureServiceDiagnosticsExtension],CloudException FullyQualifiedErrorId:Hyak.Common.CloudException,Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions.SetAzureServiceDiagnosticsExtensionCommand

我错过了什么?

1 回答

  • 0
    • 创建辅助角色时,Visual Studio会自动启用诊断1.0作为解决方案的一部分,因此您需要先禁用它 . 右键单击Worker角色>属性>配置,然后取消选中启用诊断

    enter image description here

    • 通过执行以下PowerShell命令下载公共配置文件模式定义:

    (Get-AzureServiceAvailableExtension -ExtensionName'PaaSDiagnostics'-ProviderNamespace'Microsoft.Azure.Diagnostics') . PublicConfigurationSchema | Out-File -Encoding utf8 -FilePath'WadConfig.xsd'

    • 将XML文件添加到WorkerRole项目并创建自己的诊断配置,然后将步骤2中获得的WadConfig.xsd与xml文件相关联 .

    enter image description here

    • 运行以下命令:
    $storage_name = "storageName"
    $key = "StorageAccountKey"
    $config_path="the xml path created in step 3"
    $service_name="serviceName"
    $storageContext = New-AzureStorageContext -StorageAccountName $storage_name -StorageAccountKey $key
    Set-AzureServiceDiagnosticsExtension -StorageContext $storageContext -DiagnosticsConfigurationPath $config_path -ServiceName $service_name -Slot Staging -Role WorkerRole1
    

    现在,为您的辅助角色启用了PaaS诊断扩展 . 查看更多详情here .

相关问题