gpt4 book ai didi

Azure:无法将字节发送到 XContainer wad-tracefiles

转载 作者:行者123 更新时间:2023-12-03 03:20:22 24 4
gpt4 key购买 nike

出于某种原因,我在 Azure 中使用诊断时遇到错误。我的(WCF)WebRole 的代码是:

public override bool OnStart()
{
// To enable the AzureLocalStorageTraceListner, uncomment relevent section in the web.config
DiagnosticMonitorConfiguration diagnosticConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();
diagnosticConfig.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
diagnosticConfig.Directories.DataSources.Add(AzureLocalStorageTraceListener.GetLogDirectory());
diagnosticConfig.Directories.BufferQuotaInMB = 256;

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

// Write trace line
Trace.WriteLine("CUSTUM TRACE MESSAGE");

// Start instance
return base.OnStart();
}

我的 Web.config 文件如下所示:

<?xml version="1.0"?>
<configuration>
<configSections>
</configSections>
<system.diagnostics>
<sharedListeners>
<add name="AzureLocalStorage" type="WCFServiceWebRole1.AzureLocalStorageTraceListener, WCFServiceWebRole1"/>
</sharedListeners>
<sources>
<source name="System.ServiceModel" switchValue="Verbose, ActivityTracing">
<listeners>
<add name="AzureLocalStorage"/>
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging" switchValue="Verbose">
<listeners>
<add name="AzureLocalStorage"/>
</listeners>
</source>
</sources>
<trace autoflush="true">
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>

在计算模拟器中我看到以下错误:

[MonAgentHost] Output: Monitoring Agent Started
[Diagnostics]: Starting configuration channel polling
[MonAgentHost] Error: MA EVENT: 2012-06-06T10:01:20.111Z
[MonAgentHost] Error: 2
[MonAgentHost] Error: 6396
[MonAgentHost] Error: 6624
[MonAgentHost] Error: NetTransport
[MonAgentHost] Error: 0
[MonAgentHost] Error: x:\btsdx\215\services\monitoring\shared\nettransport\src\xblobconnection.cpp
[MonAgentHost] Error: XBlobConnection::PutBytesXBlob
[MonAgentHost] Error: 1621
[MonAgentHost] Error: ffffffff80050023
[MonAgentHost] Error: 0
[MonAgentHost] Error:
[MonAgentHost] Error: Failed to send bytes to XContainer wad-tracefiles

此错误会重复多次。 “wad-tracefiles”容器是通过 AzureLocalStorageTraceListener 类中的以下代码添加的:

public static DirectoryConfiguration GetLogDirectory()
{
DirectoryConfiguration directory = new DirectoryConfiguration();
directory.Container = "wad-tracefiles";
directory.DirectoryQuotaInMB = 10;
directory.Path = RoleEnvironment.GetLocalResource("WCFServiceWebRole1.svclog").RootPath;
return directory;
}

为什么在这种情况下写入跟踪消息会失败?当我使用 Azure 存储资源管理器查看存储时,我看到的唯一表是 WADDirectoriesTable,而不是 WADLogsTable。 “wad-tracefiles”blob 确实已创建,但这不是我应该从代码中找到跟踪消息的地方。

有人有什么想法吗?如有任何帮助,我们将不胜感激!

最佳答案

您的第一个问题是您没有将 SetCurrentConfiguration() 与 GetDefaultInitialConfiguration() 一起使用来最终保存传输时间和日志级别。您必须使用以下 API 集:

GetDefaultInitialConfiguration() 
SetCurrentConfiguration()

或者

GetCurrentConfiguration()
SetCurrentConfiguration()

因此,以下基于行的配置将不会保存在诊断配置中: DiagnosticConfig.Directories.DataSources.Add(AzureLocalStorageTraceListener.GetLogDirectory());

使用上面的建议,然后看看会发生什么。

我还建议创建一个非常简单的 Web 或辅助角色 hello world 示例,并通过启用 Azure 诊断来添加常规 TRACE 消息,以查看是否会出现任何错误。这将证明您的 SDK 安装或 Azure 存储模拟器是否有任何问题。

关于Azure:无法将字节发送到 XContainer wad-tracefiles,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10913158/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com