【发布时间】:2016-07-01 08:49:55
【问题描述】:
我正在尝试使用Semantic Logging Application Block 将日志存储到Azure Table Storage。设置:
ObservableEventListener listener1 = new ObservableEventListener();
var conString =
$"DefaultEndpointsProtocol={CloudStorageAccount.DevelopmentStorageAccount.TableEndpoint.Scheme};" +
$"AccountName={CloudStorageAccount.DevelopmentStorageAccount.Credentials.AccountName};" +
$"AccountKey={Convert.ToBase64String(CloudStorageAccount.DevelopmentStorageAccount.Credentials.ExportKey())}";
listener1.LogToWindowsAzureTable( // <---- EXCEPTION HERE
instanceName: "instName",
connectionString: conString);
我遇到了一个奇怪的异常:
抛出异常:Microsoft.Practices.EnterpriseLibrary.SemanticLogging.WindowsAzure.dll 中的“System.MissingMethodException”
附加信息:找不到方法:'Void Microsoft.WindowsAzure.Storage.Table.CloudTableClient.set_RetryPolicy(Microsoft.WindowsAzure.Storage.RetryPolicies.IRetryPolicy)'。
我在使用真实帐户时遇到了同样的问题。包版本(均来自 NuGet):
- EnterpriseLibrary.SemanticLogging — 2.0.1406.1
- EnterpriseLibrary.SemanticLogging.WindowsAzure — 2.0.1406.1
- WindowsAzure.Storage — 7.0.0
如何跟踪异常的来源?Google 对未找到的方法只字未提。在你的机器上测试的项目是here。
【问题讨论】:
-
请注意,将日志上传到 Azure Tables 很好,但将它们上传到 Application Insights (AI) 更好:github.com/fidmor89/SLAB_AppInsights。如果您有标准或高级层,则可以配置连续导出到表存储并免费获得...
标签: .net azure azure-table-storage semantic-logging slab