0

有几个 stackoverflow 帖子有类似的问题,但没有一个有授权错误问题。

我在Azure China上使用带有 eventthub 触发器的 C# 代码运行 Azure 函数时遇到问题。相同的代码在 Azure 全局上运行良好。

触发器的连接字符串是正确的,我用ListenManage权限尝试过,同样的问题。

任何帮助表示赞赏。

这里是完整的错误信息:

Microsoft.Azure.WebJobs.Host.Listeners.FunctionListenerException: The listener for function 'FilterFunctionEventhubTrigger' was unable to start.

 ---> Microsoft.Azure.EventHubs.Processor.EventProcessorConfigurationException: Encountered error while fetching the list of EventHub PartitionIds

 ---> System.UnauthorizedAccessException: Unauthorized

   at Microsoft.Azure.EventHubs.Amqp.Management.AmqpServiceClient.GetRuntimeInformationAsync()

   at Microsoft.Azure.EventHubs.EventHubClient.GetRuntimeInformationAsync()

   at Microsoft.Azure.EventHubs.Processor.PartitionManager.GetPartitionIdsAsync()

   --- End of inner exception stack trace ---

   at Microsoft.Azure.EventHubs.Processor.PartitionManager.GetPartitionIdsAsync()

   at Microsoft.Azure.EventHubs.Processor.PartitionManager.GetPartitionIdsAsync()

   at Microsoft.Azure.EventHubs.Processor.PartitionManager.InitializeStoresAsync()

   at Microsoft.Azure.EventHubs.Processor.PartitionManager.StartAsync()

   at Microsoft.Azure.EventHubs.Processor.EventProcessorHost.RegisterEventProcessorFactoryAsync(IEventProcessorFactory factory, EventProcessorOptions processorOptions)

   at Microsoft.Azure.WebJobs.EventHubs.EventHubListener.StartAsync(CancellationToken cancellationToken)

   at Microsoft.Azure.WebJobs.Host.Listeners.FunctionListener.StartAsync(CancellationToken cancellationToken, Boolean allowRetry) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Listeners\FunctionListener.cs:line 68

   --- End of inner exception stack trace --

这是我的csproj文件。

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <AzureFunctionsVersion>v3</AzureFunctionsVersion>
    <RootNamespace>sss_af_filter</RootNamespace>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Azure.Messaging.EventHubs" Version="5.6.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.18.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="4.0.1" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventHubs" Version="4.2.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Logging.ApplicationInsights" Version="3.0.27" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.11" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
    <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
    <PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
    <PackageReference Include="xunit" Version="2.4.1" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>
4

1 回答 1

0

问题是 VNet 中缺少子网。

于 2021-08-24T08:24:27.317 回答