How to Create ASP.NET SignalR Self Hosting in Windows Server
And now I want to tell you how to create ASP.NET SignalR Self Hosting on your Windows Server. Before that, please read carefully this requirement:
At the time of writing you’ll need to install the following NuGet packages from Package Manager Console in Visual Studio:
Install-Package Microsoft.Owin.Hosting -Pre
Install-Package Microsoft.Owin.Host.HttpListener -Pre
You can delete the scripts folder added by SignalR, we’re really just after the assemblies:
So if you feel like only deploying the minimal assemblies you can remove anything else installed from those packages.
In this section we will create a console application for self hosting. Use the following procedure.
Step 1: Open Visual Studio and create a console application.
Step 2: Open the Package Manager Console from the Tools/Library Package Manager.
Step 3: Write the following command – install-package Microsoft.AspNet.SignalR.SelfHost -pre
Step 4: Now paste the following code in the Progran.cs file:
Step 5: Run your application.
Step 6: If you get an exception named System.Reflection.TargetInvocationException that was unhandled then it might be possible that you did not open Visual Studio as an Administrator.
Step 7: Stop the execution.