WebJob的Azure SignalR绑定.Net Core 3不工作



我有一个。Net Core 3.0控制台项目,其中包括WebJob功能,该功能具有与Azure Signal R的输出绑定。该应用程序构建正常,但当我运行它并尝试通过SignalR发送消息时,我会收到以下错误:

{System.MissingMethodException: Method not found: 'System.String Microsoft.Azure.SignalR.AuthenticationHelper.GenerateAccessToken(System.String, System.String, System.Collections.Generic.IEnumerable`1<System.Security.Claims.Claim>, System.TimeSpan, System.String)'.
at Microsoft.Azure.SignalR.Management.RestApiAccessTokenGenerator.Generate(String audience, Nullable`1 lifetime)
at Microsoft.Azure.SignalR.Management.RestApiProvider.GenerateRestApiEndpoint(String path, Nullable`1 lifetime)
at Microsoft.Azure.SignalR.Management.RestApiProvider.GetSendToGroupEndpoint(String groupName, Nullable`1 lifetime)
at Microsoft.Azure.SignalR.Management.RestHubLifetimeManager.SendGroupAsync(String groupName, String methodName, Object[] args, CancellationToken cancellationToken)
at Microsoft.AspNetCore.SignalR.Internal.GroupProxy`1.SendCoreAsync(String method, Object[] args, CancellationToken cancellationToken)
at Microsoft.Azure.WebJobs.Extensions.SignalRService.AzureSignalRClient.SendToGroup(String groupName, SignalRData data)
at Microsoft.Azure.WebJobs.Extensions.SignalRService.SignalRAsyncCollector`1.AddAsync(T item, CancellationToken cancellationToken)
at InSysWebJobP300DataProcessor.Helper.ProcessMinuteData(Message message, ConnectionMultiplexer redisConnection, IAsyncCollector`1 signalRMessages, ILogger log) in E:InergySystemsGitHubInSysCoreInSysWebJobP300DataProcessorHelper.cs:line 125}

SignalR服务已在Program中注册。Main with:

static void Main(string[] args)
{
var builder = new HostBuilder();
builder.ConfigureWebJobs(b =>
{
b.AddAzureStorageCoreServices();
b.AddServiceBus().AddSignalR();
});
builder.ConfigureLogging((context, b) =>
{
b.ClearProviders();
b.AddConfiguration(context.Configuration.GetSection("Logging"));
if (context.HostingEnvironment.IsDevelopment())
{
b.AddConsole();
}
});
var host = builder.Build();
using (host)
{
host.Run();
}
}

我有一个具有以下签名的函数:

[FunctionName("ProcessMinuteData")]
public async Task RunAsync([ServiceBusTrigger("data", Connection = "AzureWebJobsServiceBusConnection")]Message message, [SignalR(HubName = "insyshub")] IAsyncCollector<SignalRMessage> signalRMessages, ILogger log)

从服务总线接收的消息处理良好,但尝试使用以下方法通过SignalR推出消息,会导致上述错误:

await signalRMessages.AddAsync(new SignalRMessage
{
GroupName = "GroupName",
Target = "targetMethod",
Arguments = new[] { JsonConvert.SerializeObject(message) }
});

请注意,该应用程序不需要通过SignalR接收消息,只需将其推出即可。

我安装了以下NuGet软件包:

<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.1.0" />
<PackageReference Include="Microsoft.Azure.SignalR" Version="1.2.1" />
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.14" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="3.0.5" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.0.2" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" Version="4.0.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.SignalRService" Version="1.0.2" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.10" />
<PackageReference Include="Microsoft.Azure.WebJobs.Logging.ApplicationInsights" Version="3.0.14" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.0.1" />

似乎是从微软开始的。蔚蓝色的SignalR 1.2.0您现在需要包括Microsoft。蔚蓝色的信号R。管理如果你想使用我在问题中详细介绍的方法。

在1.2.0之前,您不需要包含Microsoft。蔚蓝色的信号R。经营

相关内容

  • 没有找到相关文章

最新更新