我正在尝试使用语义日志记录应用程序 block
将日志存储到Azure 表存储
中。设置:
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);
我遇到了一个奇怪的异常:
Exception thrown: 'System.MissingMethodException' in Microsoft.Practices.EnterpriseLibrary.SemanticLogging.WindowsAzure.dll
Additional information: Method not found: '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 .
最佳答案
您收到此错误的原因是 SLAB
依赖于存储客户端库 3.0.2.0 ( source
) 并在客户端 (CloudTableClient
例如)在版本 4.0.0.0 ( source
) 中已弃用,并在某些更高版本中删除(不确定是哪一个)。
由于您使用的是 7.x 版存储客户端库,因此在 CloudTableClient
上设置 RetryPolicy 的方法不存在,因此您会收到此错误。
关于.net - 如何跟踪尝试为监听器设置 Azure 接收器时的异常来源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38141018/