Azure存储:指定的租约ID与Blob的租约ID不匹配

问题描述

以下例外记录在应用程序见解中。我们在应用程序中使用了Blob触发器和Cosmos DB触发器azure函数

指定的租约ID与Blob的租约ID不符

[{“ severityLevel”:“错误”,“ parsedStack”:[{“程序集”:“ Microsoft.Azure.Storage.Common, 版本= 11.1.7.0,文化=中性, PublicKeyToken = 31bf3856ad364e35“,”方法“:” Microsoft.Azure.Storage.Core.Executor.Executor + d__1 1.MoveNext","level":0,"line":0},{"assembly":"System.Private.CoreLib,Version=4.0.0.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e","method":"System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw","level":1,"method":"System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess","level":2,"method":"System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification","level":3,"method":"System.Runtime.CompilerServices.TaskAwaiter.GetResult","level":4,{"assembly":"Microsoft.Azure.WebJobs.Host.Storage,Version=4.0.1.0,PublicKeyToken=31bf3856ad364e35","method":"Microsoft.Azure.WebJobs.Host.StorageBasedistributedLockManager+SingletonLockHandle+<RenewAsync>d__17.MoveNext","level":5,"line":349,"fileName":"C:\\projects\\azure-webjobs-sdk-rqm4t\\src\\Microsoft.Azure.WebJobs.Host.Storage\\Singleton\\BlobLeasedistributedLockManager.cs"},"level":6,"level":7,"level":8,"method":"System.Runtime.CompilerServices.TaskAwaiter 1.GetResult“,” level“:9,” line“:0},{” assembly“ :“ Microsoft.Azure.WebJobs.Host, 版本= 3.0.23.0,文化=中性, PublicKeyToken = 31bf3856ad364e35“,”方法“:” Microsoft.Azure.WebJobs.Host.SingletonManager + RenewLeaseCommand + d__4.MoveNext“,”级别“:10,”行“:337,”文件名“:” C:\ projects \ azure -webjobs-sdk-rqm4t \ src \ Microsoft.Azure.WebJobs.Host \ Singleton \ SingletonManager.cs“},{” assembly“:” System.Private.CoreLib, 版本= 4.0.0.0,文化=中性, PublicKeyToken = 7cec85d7bea7798e“,”方法“:” System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw“,”级别“:11,”行“:0},{” assembly“:” System.Private.CoreLib, 版本= 4.0.0.0,文化=中性, PublicKeyToken = 7cec85d7bea7798e“,”方法“:” System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess“,”级别“:12,”行“:0},{” assembly“:” System.Private.CoreLib, 版本= 4.0.0.0,文化=中性, PublicKeyToken = 7cec85d7bea7798e“,”方法“:” System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification“,” level“:13,” line“:0},{” assembly“:” System.Private.CoreLib, 版本= 4.0.0.0,文化=中性, PublicKeyToken = 7cec85d7bea7798e“,”方法“:” System.Runtime.CompilerServices.TaskAwaiter`1.GetResult“,”级别“:14,” line“:0},{” assembly“:” Microsoft.Azure.WebJobs.Host, 版本= 3.0.23.0,文化=中性, PublicKeyToken = 31bf3856ad364e35“,”方法“:” Microsoft.Azure.WebJobs.Host.Timers.TaskSeriesTimer + d__14.MoveNext“,”级别“:15,”行“:147,”文件名“:” C:\ projects \ azure -webjobs-sdk-rqm4t \ src \ Microsoft.Azure.WebJobs.Host \ Timers \ TaskSeriesTimer.cs“}],” outerId“:” 0“,” message“:” The 指定的租约ID与该租约的ID不符 blob。“,”类型“:” Microsoft.Azure.Storage.StorageException“,” id“:” 57667516“}]

Blob触发Azure功能

public static class ProcessEvent
    {
        [FunctionName(nameof(ProcessEvent))]
        public static async Task Run([BlobTrigger(BlobStorageContainer.Name + "/{name}",Connection = "AzureWebJobsstorage")]
            Stream eventBlob,string name,[Inject] ILoggingService loggingService,[Inject] IEventProcessdispatcher eventProcessor)
        {
            var logger = new Logger(loggingService);
            try
            {
                logger.Info($"Starting blob job tracker for file name {name}",nameof(ProcessEvent));

                var eventContent = eventBlob.ReadAsstring();

                await eventProcessor.HandleProcessor(eventContent,logger);

                logger.Info(
                    $"blob trigger function processed",nameof(ProcessEvent));
            }
            catch (Exception ex)
            {
                logger.Error($"Unable to process blob job for file with name: {name}",ex,nameof(ProcessEvent));
            }
        }
    }

Cosmos DB触发器Azure功能

public static class NotificationChangeFeed
    {
        [FunctionName(nameof(NotificationChangeFeed))]
        public static async Task Run([CosmosDBTrigger(
            databaseName: CosmosDBConstants.DataBaseName,collectionName: CosmosDBConstants.NotificationContainer,ConnectionStringSetting = CosmosDBConstants.ConnectionStringName,CreateLeaseCollectionIfNotExists = true,LeaseCollectionName = CosmosDBConstants.LeaseConainer)]IReadOnlyList<Document> input,[Inject] IEmailProcessor emailProcessor)
        {
            var logger = new Logger(loggingService);

            try
            {
                if (input != null && input.Count > 0)
                {
                    foreach (Document document in input)
                    {
                        string requestBody = document.ToString();
                        var notification = requestBody.AsPoco<Notification>();

                        await emailProcessor.HandleEmailAsync(notification,logger);
                        logger.Info($"Email Notification sent successfully for file name: {document.Id}");
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error($"Unable to process Documents for Email Notification for Files: {input?.Count}",nameof(NotificationChangeFeed));
                throw;
            }
        }
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)