What are my options for self-hosting SignalR? - c#

I want to add SignalR to my Windows service, written in C#, targetting .NET 4.0. The Microsoft.Owin.* packages appear to require .NET 4.5.
I'd also like to include NancyFX in the same process, for other reasons.
What's the best way to self-host SignalR?

I installed the signalR package (v. 1.1.2) using .net 4.0. Work as a charm. I cannot use 4.5 as I am still at VS2010.
I use it with a standard web project with a WebService handling the communication.

The only Microsoft OWIN package that requires 4.5 is owinhost.exe (used to be katana.exe), you can still use normal http listener (Microsoft.Owin.Host.HttpListener) to self host just fine.

If you install the packages as listed at https://github.com/SignalR/SignalR/wiki/Self-host they should work just fine under .NET 4.0. It's worth remembering that you can always use the package manager console to explicitly install older versions of packages if you need to - although for SignalR at the time of writing there is no need to do this.

Related

Backward .NET compatibility for NuGet packages?

I'm accustomed to the Java world: it's generally safe to run an application on a newer JRE that has dependent .jars compiled with older versions of Java.
.Net is a bit stricter. For example, if I build an ASP.NET app with TargetFramework "netcoreapp3.1", then I MUST install ASP.Net Core 3.1 runtime on every host server I deploy the app on. I can't just install .NET 7 on the host server, and expect it to work. Correct?
Q: What about NuGet packages? Do I need to install the corresponding .NET or .NET Core runtimes for every NuGet dependency my app uses?
I would recommend using Docker, or any other container platform like Kubernetes to manage applications like this. It's designed just to avoid situations like this where your application changes to rely on new assets. So you could just basically change the version by just changing a number in your Dockerfile before build and deploy it like any other upgrade. This method is always best practice today. Just swap server application images on your servers for each deployment, no installations.
Alternatively, you could build your application as self-contained (runtime/executable included in your build).
To answer the question, you need the same runtime as your application targers.

using Rabbitmq client in .core 2.0

I am building an application in .net core 2.0 and we have a requirement to subscribe and publish messages to RabbitMQ. Could find NuGet package which uses standard .net library[a hell lot of DLLs get added]. however, I am looking for pure .net core application which can be hosted in Linux as well.
Does anyone has implemented the same stuff?

Does .Net core 2.0 supports Apache NMS Active MQ packages?

Warning NU1701 Package 'Apache.NMS 1.7.1' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project.
I've tested Apache.NMS and Apache.NMS.ActiveMQ DLLs from nuget packages with .NET Portability Analyzer, it said they are 100% compatible with: ".NET Core,.NET Framework,.NET Standard". I also tested it in simple scenarios like linux .net core app writing to queue, it worked. So i'd say they are functional, but can't be sure to what degree.
We use it in production for about half a year, no issues. We only do posting messages to MQ though.
You can try this packages for .NET Core
Apache.NMS.NetCore
Apache.NMS.ActiveMQ.NetCore
I'm not sure for now that you can do that, sorry, another alternative is to take classes that consume ActiveMQ by REST, http://activemq.apache.org/rest.html
and do not use these dlls.

The dependency Twilio in project does not support framework DNXCore, Version=v5.0

I'm interested in figuring out how to use the Twilio API, and I am building an ASP.NET 5 application using the Twilio API with MVC6 (trying to follow this tutorial). So far, I have created an empty ASP.NET 5 application, and I added "Twilio" to the dependencies in project.json. I get the following error:
"The dependency Twilio 4.0.3 in project TwilioTest does not support framework DNXCore, Version v5.0"
I notice that when I remove "dnxcore50" from "frameworks", the error goes away.
I'm not sure what this means or how to approach it. I'm still pretty new to .NET and trying to wrap my head around how all of the pieces fit together. Does it mean that Twilio isn't compatible with DNXCore? Since all I want to do for now is learn how to use Twilio, could I essentially remove the dnxcore50 framework from the project and continue working through building the app?
The Twillio NuGet package is dependent on the full .NET stack, which in project.json frameworks terms is DNX451. What that means is, you can add the Twillio NuGet package and remove the DNXCORE50 reference and your project will run as expected and you will be able to use the Twillio API. As far as I know the only major drawback is that your ASP.NET Core project will no longer be cross platform as you are now dependent on the full .NET Framework stack which is only present in Windows.
In a nutshell, you should be fine unless you are planning to deploy to Linux/OSx. Hopefully as ASP.NET CORE becomes mainstream more 3rd party SDKs will be built to require only DNXCORE50 as a dependency.
Another option don't use the Twillio Libraries and code against their REST API. See documentation here: https://www.twilio.com/docs/api. But I wouldn't recommend this if you are deploying to a Windows environment.
Twilio is working on their .Net Standard (Core) library. In the meantime, I've published a .Net Core port of their library to unblock our current projects until we get the official update. Feel free to take it for a spin:
Install Twilio.NetCore from Nuget.
And you can check out the source on Github.

Deploying windows forms project without installing .NET 4.0 client

I have made a windows forms application on VS2010 with .NET 4.0, Now its time to deploy on the client side, I was wondering if there is any way to make a setup that includes all the libs and dlls (of .NET framework) that will be needed at client side to run the application "without installing .NET 4.0 client/ framework" on the concerned node, what settings will be needed to do so.
Thanks in advance
MGD
No, you need to deploy .net properly.

Categories

Resources