I'm trying to host a Signalr hub in my .NET Core 3.0 console application. What I coded is as follows. When I run I got "GetStreamItemType does not have implementation" exception.
static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args).UseStartup<Startup>().Build();
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddSignalR();
}
public void Configure(IApplicationBuilder app, Microsoft.Extensions.Hosting.IHostEnvironment env)
{
app.UseSignalR(routes =>
{
routes.MapHub<Connector>("/connector");
});
}
}
Connector is my hub class derived from Microsoft.AspNetCore.SignalR.Hub When the app starts I get following exception and cannot figure out why.
System.TypeLoadException
HResult=0x80131522
Message=Method 'GetStreamItemType' in type 'Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1' from assembly 'Microsoft.AspNetCore.SignalR.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation.
Source=Microsoft.AspNetCore.SignalR.Core
StackTrace:
at Microsoft.Extensions.DependencyInjection.SignalRDependencyInjectionExtensions.AddSignalRCore(IServiceCollection services) in /_/src/Microsoft.AspNetCore.SignalR.Core/SignalRDependencyInjectionExtensions.cs:line 36
When this error is thrown ensure you have the same version of Microsoft.AspNetCore.SignalR
and Microsoft.AspNetCore.SignalR.Client
I gave up while searching the reason and trying to understand GetStreamItemType exception. Finally I created a blank .NET Core Web App and transferred my code from console app into this new app.
User contributions licensed under CC BY-SA 3.0