无法创建任务中心:DurableTask.AzureStorage.Storage.DurableTaskStorageException
Failed to create the task hub: DurableTask.AzureStorage.Storage.DurableTaskStorageException
我已将我的 Azure Functions 项目从 .Net Core 2.2 迁移到 .Net Core 3.1。因此,我还更新了其他 nuget 包以支持 .Net Core 3.1。之后,当我 运行 我的函数项目时,它加载了所有函数,加载后它连续失败并出现以下错误。
General error: Failed to create the task hub: DurableTask.AzureStorage.Storage.DurableTaskStorageException: The response ended prematurely, with at least 93 additional bytes expected.
[2022-03-28T14:37:38.222Z] ---> Microsoft.WindowsAzure.Storage.StorageException: The response ended prematurely, with at least 93 additional bytes expected.
[2022-03-28T14:37:38.225Z] ---> System.IO.IOException: The response ended prematurely, with at least 93 additional bytes expected.
[2022-03-28T14:37:38.226Z] at System.Net.Http.HttpConnection.ContentLengthReadStream.ReadAsync(Memory1 buffer, CancellationToken cancellationToken) [2022-03-28T14:37:38.228Z] at Microsoft.WindowsAzure.Storage.Core.Util.StreamExtensions.WriteToAsync[T](Stream stream, Stream toStream, IBufferManager bufferManager, Nullable1 copyLength, Nullable1 maxLength, Boolean calculateMd5, ExecutionState1 executionState, StreamDescriptor streamCopyState, CancellationToken token)
[2022-03-28T14:37:38.230Z] at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteAsyncInternal[T](RESTCommand1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token) [2022-03-28T14:37:38.232Z] --- End of inner exception stack trace --- [2022-03-28T14:37:38.233Z] at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteAsyncInternal[T](RESTCommand1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token)
[2022-03-28T14:37:38.235Z] at Microsoft.WindowsAzure.Storage.Blob.CloudBlob.DownloadRangeToStreamAsync(Stream target, Nullable1 offset, Nullable1 length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, IProgress1 progressHandler, CancellationToken cancellationToken) [2022-03-28T14:37:38.237Z] at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.DownloadTextAsync(Encoding encoding, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, IProgress1 progressHandler, CancellationToken cancellationToken)
[2022-03-28T14:37:38.241Z] at DurableTask.AzureStorage.TimeoutHandler.ExecuteWithTimeout[T](String operationName, String account, AzureStorageOrchestrationServiceSettings settings, Func3 operation, AzureStorageOrchestrationServiceStats stats, String clientRequestId) [2022-03-28T14:37:38.243Z] at DurableTask.AzureStorage.Storage.AzureStorageClient.MakeStorageRequest[T](Func3 storageRequest, String accountName, String operationName, String clientRequestId) in //src/DurableTask.AzureStorage/Storage/AzureStorageClient.cs:line 133
[2022-03-28T14:37:38.245Z] Request Information
[2022-03-28T14:37:38.246Z] RequestID:e48ed975-d669-4f3e-a24e-bee26fe21569
[2022-03-28T14:37:38.248Z] RequestDate:Mon, 28 Mar 2022 10:37:33 GMT
[2022-03-28T14:37:38.249Z] StatusMessage:InternalServerError
[2022-03-28T14:37:38.250Z] ErrorCode:
[2022-03-28T14:37:38.252Z]
[2022-03-28T14:37:38.253Z] --- End of inner exception stack trace ---
[2022-03-28T14:37:38.256Z] at DurableTask.AzureStorage.Storage.AzureStorageClient.MakeStorageRequest[T](Func`3 storageRequest, String accountName, String operationName, String clientRequestId) in //src/DurableTask.AzureStorage/Storage/AzureStorageClient.cs:line 137
[2022-03-28T14:37:38.258Z] at DurableTask.AzureStorage.Storage.Blob.DownloadTextAsync() in //src/DurableTask.AzureStorage/Storage/Blob.cs:line 91
[2022-03-28T14:37:38.260Z] at DurableTask.AzureStorage.Partitioning.BlobLeaseManager.GetTaskHubInfoAsync() in //src/DurableTask.AzureStorage/Partitioning/BlobLeaseManager.cs:line 315
[2022-03-28T14:37:38.262Z] at DurableTask.AzureStorage.Partitioning.BlobLeaseManager.GetOrCreateTaskHubInfoAsync(TaskHubInfo newTaskHubInfo, Boolean checkIfStale) in //src/DurableTask.AzureStorage/Partitioning/BlobLeaseManager.cs:line 266
[2022-03-28T14:37:38.263Z] at DurableTask.AzureStorage.Partitioning.BlobLeaseManager.CreateLeaseStoreIfNotExistsAsync(TaskHubInfo eventHubInfo, Boolean checkIfStale) in //src/DurableTask.AzureStorage/Partitioning/BlobLeaseManager.cs:line 70
[2022-03-28T14:37:38.265Z] at DurableTask.AzureStorage.AzureStorageOrchestrationService.GetTaskHubCreatorTask() in //src/DurableTask.AzureStorage/AzureStorageOrchestrationService.cs:line 308
[2022-03-28T14:37:38.267Z] at DurableTask.AzureStorage.AzureStorageOrchestrationService.EnsureTaskHubAsync() in //src/DurableTask.AzureStorage/AzureStorageOrchestrationService.cs:line 285
[2022-03-28T14:37:38.425Z] Starting task hub worker. InstanceId: . Function: . HubName: CdpRefreshHub. AppName: . SlotName: . ExtensionVersion: 2.6.1. SequenceNumber: 1.
[2022-03-28T14:37:38.441Z] The listener for function 'ExecuteGetCommissioningAsync' was unable to start.
[2022-03-28T14:37:38.443Z] The listener for function 'ExecuteGetCommissioningAsync' was unable to start. DurableTask.AzureStorage: The response ended prematurely, with at least 93 additional bytes expected. Microsoft.WindowsAzure.Storage: The response ended prematurely, with at least 93 additional bytes expected. System.Net.Http: The response ended prematurely, with at least 93 additional bytes expected.
[2022-03-28T14:37:40.458Z] Retrying to start listener for function 'ExecuteGetCommissioningAsync' (Attempt 1)
.csproj 文件(之前)
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AzureFunctionsVersion>v2</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Common1" Version="1.0.21" />
<PackageReference Include="Common2" Version="3.12.0.1" />
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="1.8.7" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.2.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.29" />
</ItemGroup>
.csproj 文件(之后)
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Common1" Version="1.0.33.3" />
<PackageReference Include="Common2" Version="3.12.1.4" />
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.5.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.18" />
<PackageReference Include="Microsoft.Extensions.Http" Version="3.1.18" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.18" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.18" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.13" />
</ItemGroup>
我创建了 .NET Core 2.2 Azure Functions 项目(Http 触发器)并添加了相同的 NuGet 包以及提供的相同版本。
并使用提供的相同 NuGet 版本控制包迁移到 .NET Core 3.1,但在 local.settings.json
文件中,将 AzureWebJobsStorage
值从本地存储替换为 Azure 存储帐户连接字符串。
With the local storage emulator ("AzureWebJobsStorage": "UseDevelopmentStorage=true"
), it didn't work.
根据给定的错误详细信息,我认为该错误是由于存储连接字符串不匹配造成的。
结果:
我已将我的 Azure Functions 项目从 .Net Core 2.2 迁移到 .Net Core 3.1。因此,我还更新了其他 nuget 包以支持 .Net Core 3.1。之后,当我 运行 我的函数项目时,它加载了所有函数,加载后它连续失败并出现以下错误。
General error: Failed to create the task hub: DurableTask.AzureStorage.Storage.DurableTaskStorageException: The response ended prematurely, with at least 93 additional bytes expected.
[2022-03-28T14:37:38.222Z] ---> Microsoft.WindowsAzure.Storage.StorageException: The response ended prematurely, with at least 93 additional bytes expected.
[2022-03-28T14:37:38.225Z] ---> System.IO.IOException: The response ended prematurely, with at least 93 additional bytes expected.
[2022-03-28T14:37:38.226Z] at System.Net.Http.HttpConnection.ContentLengthReadStream.ReadAsync(Memory1 buffer, CancellationToken cancellationToken) [2022-03-28T14:37:38.228Z] at Microsoft.WindowsAzure.Storage.Core.Util.StreamExtensions.WriteToAsync[T](Stream stream, Stream toStream, IBufferManager bufferManager, Nullable1 copyLength, Nullable1 maxLength, Boolean calculateMd5, ExecutionState1 executionState, StreamDescriptor streamCopyState, CancellationToken token)
[2022-03-28T14:37:38.230Z] at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteAsyncInternal[T](RESTCommand1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token) [2022-03-28T14:37:38.232Z] --- End of inner exception stack trace --- [2022-03-28T14:37:38.233Z] at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteAsyncInternal[T](RESTCommand1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token)
[2022-03-28T14:37:38.235Z] at Microsoft.WindowsAzure.Storage.Blob.CloudBlob.DownloadRangeToStreamAsync(Stream target, Nullable1 offset, Nullable1 length, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, IProgress1 progressHandler, CancellationToken cancellationToken) [2022-03-28T14:37:38.237Z] at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.DownloadTextAsync(Encoding encoding, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext, IProgress1 progressHandler, CancellationToken cancellationToken)
[2022-03-28T14:37:38.241Z] at DurableTask.AzureStorage.TimeoutHandler.ExecuteWithTimeout[T](String operationName, String account, AzureStorageOrchestrationServiceSettings settings, Func3 operation, AzureStorageOrchestrationServiceStats stats, String clientRequestId) [2022-03-28T14:37:38.243Z] at DurableTask.AzureStorage.Storage.AzureStorageClient.MakeStorageRequest[T](Func3 storageRequest, String accountName, String operationName, String clientRequestId) in //src/DurableTask.AzureStorage/Storage/AzureStorageClient.cs:line 133
[2022-03-28T14:37:38.245Z] Request Information
[2022-03-28T14:37:38.246Z] RequestID:e48ed975-d669-4f3e-a24e-bee26fe21569
[2022-03-28T14:37:38.248Z] RequestDate:Mon, 28 Mar 2022 10:37:33 GMT
[2022-03-28T14:37:38.249Z] StatusMessage:InternalServerError
[2022-03-28T14:37:38.250Z] ErrorCode:
[2022-03-28T14:37:38.252Z]
[2022-03-28T14:37:38.253Z] --- End of inner exception stack trace ---
[2022-03-28T14:37:38.256Z] at DurableTask.AzureStorage.Storage.AzureStorageClient.MakeStorageRequest[T](Func`3 storageRequest, String accountName, String operationName, String clientRequestId) in //src/DurableTask.AzureStorage/Storage/AzureStorageClient.cs:line 137
[2022-03-28T14:37:38.258Z] at DurableTask.AzureStorage.Storage.Blob.DownloadTextAsync() in //src/DurableTask.AzureStorage/Storage/Blob.cs:line 91
[2022-03-28T14:37:38.260Z] at DurableTask.AzureStorage.Partitioning.BlobLeaseManager.GetTaskHubInfoAsync() in //src/DurableTask.AzureStorage/Partitioning/BlobLeaseManager.cs:line 315
[2022-03-28T14:37:38.262Z] at DurableTask.AzureStorage.Partitioning.BlobLeaseManager.GetOrCreateTaskHubInfoAsync(TaskHubInfo newTaskHubInfo, Boolean checkIfStale) in //src/DurableTask.AzureStorage/Partitioning/BlobLeaseManager.cs:line 266
[2022-03-28T14:37:38.263Z] at DurableTask.AzureStorage.Partitioning.BlobLeaseManager.CreateLeaseStoreIfNotExistsAsync(TaskHubInfo eventHubInfo, Boolean checkIfStale) in //src/DurableTask.AzureStorage/Partitioning/BlobLeaseManager.cs:line 70
[2022-03-28T14:37:38.265Z] at DurableTask.AzureStorage.AzureStorageOrchestrationService.GetTaskHubCreatorTask() in //src/DurableTask.AzureStorage/AzureStorageOrchestrationService.cs:line 308
[2022-03-28T14:37:38.267Z] at DurableTask.AzureStorage.AzureStorageOrchestrationService.EnsureTaskHubAsync() in //src/DurableTask.AzureStorage/AzureStorageOrchestrationService.cs:line 285
[2022-03-28T14:37:38.425Z] Starting task hub worker. InstanceId: . Function: . HubName: CdpRefreshHub. AppName: . SlotName: . ExtensionVersion: 2.6.1. SequenceNumber: 1.
[2022-03-28T14:37:38.441Z] The listener for function 'ExecuteGetCommissioningAsync' was unable to start.
[2022-03-28T14:37:38.443Z] The listener for function 'ExecuteGetCommissioningAsync' was unable to start. DurableTask.AzureStorage: The response ended prematurely, with at least 93 additional bytes expected. Microsoft.WindowsAzure.Storage: The response ended prematurely, with at least 93 additional bytes expected. System.Net.Http: The response ended prematurely, with at least 93 additional bytes expected.
[2022-03-28T14:37:40.458Z] Retrying to start listener for function 'ExecuteGetCommissioningAsync' (Attempt 1)
.csproj 文件(之前)
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AzureFunctionsVersion>v2</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Common1" Version="1.0.21" />
<PackageReference Include="Common2" Version="3.12.0.1" />
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="1.8.7" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.2.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.29" />
</ItemGroup>
.csproj 文件(之后)
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Common1" Version="1.0.33.3" />
<PackageReference Include="Common2" Version="3.12.1.4" />
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.5.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.18" />
<PackageReference Include="Microsoft.Extensions.Http" Version="3.1.18" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.18" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.18" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.13" />
</ItemGroup>
我创建了 .NET Core 2.2 Azure Functions 项目(Http 触发器)并添加了相同的 NuGet 包以及提供的相同版本。
并使用提供的相同 NuGet 版本控制包迁移到 .NET Core 3.1,但在 local.settings.json
文件中,将 AzureWebJobsStorage
值从本地存储替换为 Azure 存储帐户连接字符串。
With the local storage emulator (
"AzureWebJobsStorage": "UseDevelopmentStorage=true"
), it didn't work.
根据给定的错误详细信息,我认为该错误是由于存储连接字符串不匹配造成的。
结果: