0

我正在尝试为我的 Azure Web 应用程序(进行中)实现 SLAB,而我的侦听器是 Azure 表存储(表连接字符串),我面临的问题是 -“EventSource.IsEnabled() = 总是返回 false”(我正在从VS2013 带 IIS express)

我的代码

————global.asax

var listener2 = new ObservableEventListener();
listener2.EnableEvents(SBEvents.Log, EventLevel.Verbose,Keywords.All);
listener2.LogToWindowsAzureTable(“sdf”, “DefaultEndpointsProtocol=https;AccountName=********;AccountKey=****************);

———-事件源

Public class SBEvents :EventSource {
public class keywords{...}
public class Tasks {..}

private static readonly Lazy Instance = new Lazy(() => new SBEvents());
public static SBEvents Log { get { return Instance.Value; } }

[Event(102, Message = “Bike started with Bike ID :{0}”, Keywords =    Keywords.Application, Level = EventLevel.Informational)]
public void BikeStarted(String BikeID){
if (this.IsEnabled()) //// = always returns false
this.WriteEvent(102,BikeID);
4

1 回答 1

0

看起来“Azure Web Apps”无法监听 ETW 事件。

https://azure.microsoft.com/en-in/documentation/articles/choose-web-site-cloud-service-vm/

Azure 上的 Web 应用程序无法使用的诊断日志记录和跟踪领域是 Windows ETW 事件和常见的 Windows 事件日志(例如系统、应用程序和安全事件日志)。由于 ETW 跟踪信息可能在机器范围内可见(使用正确的 ACL),因此阻止了对 ETW 事件的读取和写入访问。开发人员可能会注意到用于读取和写入 ETW 事件和常见 Windows 事件日志的 API 调用似乎可以正常工作,但这是因为 WEB 应用程序“伪造”了这些调用,以便它们看起来成功。实际上,Web 应用程序代码无法访问此事件数据

谢谢

于 2015-12-02T02:54:35.203 回答