无法创建任务中心:持久性任务. Azure存储.存储.持久性任务存储异常

siotufzp  于 2022-11-17  发布在  其他
关注(0)|答案(2)|浏览(248)

我已经将我的Azure函数项目从.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>
nhhxz33t

nhhxz33t1#

我已经创建了.NET Core 2.2 Azure Functions项目(Http触发器),并添加了相同的NuGet包沿着提供的相同版本。
并使用提供的相同NuGet版本化包迁移到.NET Core 3.1,但在local.settings.json文件中,将本地存储中的AzureWebJobsStorage值替换为Azure存储帐户连接字符串。
使用本地存储模拟器("AzureWebJobsStorage": "UseDevelopmentStorage=true")时,它不起作用。
我认为该错误是由于存储连接字符串与给定的错误详细信息不匹配所致。

结果

0yg35tkg

0yg35tkg2#

我正在使用VS-2022。此问题已通过以下步骤解决。
1.使用以下命令在本地计算机中运行Azurite
azurite --silent --location c:\azurite --debug c:\azurite\debug.log
1.在local.settings.json中,使用以下代码:
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true"}
1.(可选),启动模拟器并检查是否有错误
就是这样!

相关问题