none
Host a SignalR Hub in a .NET Core 3.1 Console Application RRS feed

  • Question

  • I migrating an old .NET library hosted by an exe from .NET Framework 4.6 to .NET Core 3.1. A part of the assembly is based on a stand alone SignalR hub implemented like this. 

    //-----------------------------------
    // Startup SignalR Server
    //-----------------------------------
    m_oSignalRServer = WebApp.Start( C_AppSettings.ServerURL );

    I understod that the host must be initiated with IHostBuilder and Host.CreateDefaultBuilder but I really don understand how to configure it. And especially, how to I specify the bindings and hub names.

    Sample code or books are welcome.

    https://docs.microsoft.com/en-us/aspnet/core/signalr/configuration?view=aspnetcore-3.1&tabs=dotnet

            public static IHostBuilder CreateHostBuilder( string [ ] args ) =>
            Host.CreateDefaultBuilder( args )
                .ConfigureServices( ( hostContext, services ) =>
                {
                    services.AddSignalR( ( hubOptions =>
                    {
                        hubOptions.EnableDetailedErrors = true;
                        hubOptions.KeepAliveInterval = TimeSpan.FromMinutes( 1 );
                    } ));
                } );

    Thanks in advance!




    • Edited by Soljes Tuesday, February 25, 2020 9:39 PM
    Tuesday, February 25, 2020 9:37 PM

All replies

  • Hi Soljes, 

    Welcome to MSDN forum.

    Refer to the information you provided, I suppose this issue is more about ASP.NET Core and our forum is to discuss the.NET Framework Setup and Servicing issue, so I suggest you could redirect to Stack Overflow tagged asp.net-core forum and start a new thread to seek for a more professional help.

    In addition, about using hubs in SignalR, you could refer to the following link and hope it helps:

    https://docs.microsoft.com/en-us/aspnet/core/signalr/hubs?view=aspnetcore-3.1

    If you have any more .NET Framework Setup and Servicing issues in the future, please feel free to let us know.

    Sorry for any inconvenience and thanks for your understanding. 

    Best Regards,

    Anna

    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Wednesday, February 26, 2020 8:32 AM