gpt4 book ai didi

azure - 在我的 blob 中找不到 wad-iis-failedreqlogfiles

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

我使用这个web.config:

 <traceAreas>
<add provider="ASP" verbosity="Verbose" />
<add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
<add provider="ISAPI Extension" verbosity="Verbose" />
<add provider="WWW Server" areas="Security" verbosity="Verbose" />
</traceAreas>
<failureDefinitions statusCodes="200-999" />

并在webrole.cs

public override bool OnStart()
{
//Get Default Config
DiagnosticMonitorConfiguration config = DiagnosticMonitor.GetDefaultInitialConfiguration();
//IIS Logs
config.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
Trace.WriteLine("WAD Monitor started", "Information");


DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", config);

RoleEnvironment.Changing += RoleEnvironmentChanging;
return base.OnStart();
}

我可以获取 wad-iis-logsfiles blob,但在模拟器上无法获取 wad-iis-failedreqlogfiles blob为什么从 200-999 开始包括所有请求!并且应该有一个日志文件。

最佳答案

好吧,我所做的是在 WebRole 文件中设置我的设置,并且我添加到 web.config 的代码就是这个配置

  <system.diagnostics>
<trace>
<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.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<tracing>
<traceFailedRequests>
<add path="*">
<traceAreas>
<add provider="ASP" verbosity="Verbose" />
<add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
<add provider="ISAPI Extension" verbosity="Verbose" />
<add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module" verbosity="Verbose" />
</traceAreas>
<failureDefinitions verbosity="Warning" statusCodes="400-599" />
</add>
</traceFailedRequests>
</tracing>
</system.webServer>

然后我使用此配置实现 Onstart 方法。

   public override bool OnStart()
{
String wadConnectionString = "Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString";

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

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

DiagnosticMonitorConfiguration config = roleInstanceDiagnosticManager.GetCurrentConfiguration();

//Add Events
config.WindowsEventLog.DataSources.Add("System!*");
config.WindowsEventLog.DataSources.Add("Application!*");
config.WindowsEventLog.ScheduledTransferLogLevelFilter = LogLevel.Error;
config.WindowsEventLog.ScheduledTransferPeriod =TimeSpan.FromSeconds(15.0);
config.Logs.ScheduledTransferLogLevelFilter = LogLevel.Verbose;
config.Logs.ScheduledTransferPeriod = TimeSpan.FromSeconds(15.0);

//transfer the IIS and IIS Failed Request Logs
config.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1.0);

roleInstanceDiagnosticManager.SetCurrentConfiguration(config);

return base.OnStart();
}

我还建议您检查 WerRole 设置上的 ConnectionString,它应该如下所示:

“DefaultEndpointsProtocol=http;AccountName=myAccount;AccountKey=8zTMPlQ8N76cEUNGLYhIvPf8lDmmTnCm7BICX/xtPmdr9vN7elOvZS5N2njtg+tbStoCoe30doN0sCrE1LHcsd==”

“UseDevelopmentStorage=true”

如果您想在自己的开发环境中工作

您也可以访问此网站了解更多详细信息

http://robindotnet.wordpress.com/2011/02/16/azure-toolssdk-1-3-and-iis-logging/

关于azure - 在我的 blob 中找不到 wad-iis-failedreqlogfiles,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13085417/

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