How to version SignalR websockets? - asp.net-core

We are building a web application in Asp.Net Core that will be used to centralize and communicate with a lot of instances of a custom servers(which is in C# too).
We need versionning, because updating those custom servers is really time consuming and can be a blocker for people to install newer version of the web app.
For the HTTP part, it's "easy", we have to use the Asp.Net Core versionning and a given version of the custom server will know how to communicate with a given version of the web app.
But we have a SignalR service that is used to provide notification to the custom servers from the web app, and request some data, some actions, ... Is there a way to provide several version of the client interface for this? And having the signalR server able to transform the message to each version?
Thank you

Related

Create a websocket server olny for .net core console application without using Asp .net core packages

We need to migrate our application to .Net core and we had a dependency with a websocket library build for .Net Framework 3.5 . websocket-sharp
Until now i can not found a libray implementation for websocket that use only .Net Core not Asp Net core.
example of library with ASP are :
Kestrel
SingelR
But we shall not use ASP packages juste to integrate à websocket implementation.
Can anyone help me to find a websocket implementation using only .Net core layer not ASP.Net core ?
Here is a web socket server that does NOT depend on Kestrel or ASP, making it fully compatible with .NET Core and Mono.
https://github.com/jchristn/WatsonWebsocket
It should be very futureproof because of its minimal dependencies. Note that the author is a former Cisco Engineer with several other easy-to-use .net client/server libraries. I have used his other libraries with tremendous ease and success. He deserves support and respect for his efforts.
A big plus about his libraries is that they are quite minimal. They make getting up and running as easy as possible by offering only the most basic essentials you would want for servers and clients. Things like client-management, request routing, etc will depend on you to implement. I find this highly favorable.
UPDATE 11/7/2020: Joel has stated that he intends to rewrite the underlying portions of WatsonWebSocket so that it does not rely on HttpListener or http.sys. It will rely on his alternate custom http listener. This is great news because HttpListener is deprecated and has a sketchy future.
The abstract ClientWebSocketClass is an implementation for websockets that is not dependent on ASP.NET core. So you can do use that for client side communication with any websocket implemtnation.
The server side part will need an HTTP server since websocket connection are achieved by creating a normal HTTP request and the connection is upgraded to websocket. So you need a webserver to receive the initial request.

SignalR .net core client in .NET framework 4 apllication

I have 2 applications:
NetCore 2.2 web-application
.Net Framework 4 web-application (owin, nancy-framework). For some reasons I cant upgrade target net framework version in this
application.
There is a requirement to provide two-way connection. In other words, I want to send commands from 1st app to 2nd app.
More about the situation:
With current network organization I can make request from 2-app to 1-app, it works successfully.
But I can't make request from 1-app to 2-app (host of 2nd app is not pingable from 1st app). I was hoping to solve the problem with SignalR library, but it has platform-depend limitations (signalR Core client library in old applications, Microsoft.AspNetCore.SignalR.Client package).
How can i solve this problem? Maybe I have some alternatives?

Which method I should track to know a new request comes into .net core application

I'm implementing profiler to track http requests coming to .net core applications hosted in IIS. I'm using coreclr profiling api to hook method enter/exit.
Which method I should track to know a new http request coming into my application.
Create a middle ware and configure ASP.NET Core to use it. It should receive requests, process it, then pass it along with the pipeline.
For more information see here: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/?view=aspnetcore-2.2

Does ASP.NET Core on .NET Core follow the console app model, or the IIS hosting model?

Currently I maintain an application that runs as a Windows service, reads messages from a message queue server, processes them and puts the result back into the message queue server. But it also contains a health monitoring component that is accessible through a web API.
It is implemented as a console app that uses Katana to self-host the health monitoring sub-system.
I'm now trying to figure out if we can move this to .NET Core and ASP.NET Core once they RTM. I know the Windows Service part cannot be ported, but I could also run the console app as a detached Docker container to basically achieve the same thing, in terms of main functionality.
But how will the health monitoring work? From what I can see the Katana project has been updated to ASP.NET 5 (which I guess is ASP.NET Core 1 before the big rename), but it does not run on the .NET Core CLR. Katana will require the full CLR. So that means Katana is out.
Does this mean that the way we build our app is impossible with .NET Core? Or does hosting the app through Kestrel not rule out the possibility of running code before the first request? With IIS the app does not live until the first request (unless you use the auto-start, but it's more of a speed-optimisation than have the app behave like an "allways-running-app") and generally the app is request-based and not continually running. Background threads in a IIS hosted app are a really bad idea.
Is this the same with Kestrel? Or will DNX start your app and keep it running until it's shutdown, much like a console app, so we can run all the background threads we want?
It follows the console app model. Katana is actually more the spiritual predecessor to kestrel. It is invoked for normal ASP.NET Core projects from the Main method with a normal method call. There are countless tutorials how to setup a server in RC1 (see Startup.cs Main method) and some for the upcoming RC2 (there is a builder for it). That would allow you to do both, your app code and your web api based monitoring, in a console app. Kestrel and DNX are not at all an application server like IIS. Kestrel is a plain HTTP server library and nothing more. You start it up and it listens from that moment on.
Nevertheless, you have to adjust your WebApi 2 and Katana based application to the new ASP.NET Core interfaces and middleware concept. But that should be easy compared to your message queuing adaption.

Creating a content hub and client application using Piranha CMS

First off, I need to mention that I'm not sure if what I'm trying to achieve is even supported by Piranha CMS (that's partly what I'm trying to determine here). They mention the ability to create a standalone content hub on their website, but my assumptions of what is possible with that model might be incorrect. What I've already done is created an ASP.NET MVC application that is hosting Piranha CMS and I've published it to Azure websites for testing purposes--that part works as expected. The content management interface is the only user facing piece here--it is meant only to serve as the content hub for the client application (just the one for now as this is just proof of concept work).
I am now trying to build a client ASP.NET MVC application that pulls content from the hub. This is where I'm thinking that my assumptions may have been wrong. I was thinking that I'd be able to install the Piranha CMS nuget package(s) on the client as well, and I'd be able to configure the framework to get content from the hub in the same way that it would if the content were hosted on the client site. I realize that I could get the content from the hub using Piranha's REST api, but what I want to do is to be able to use the more friendly entity model based api for this.
So my question is whether it is possible (within reason) to setup Piranha CMS in the way that I've described. If it is, how exactly do I configure the client such that it is aware of the location of the content hub?
There are currently no .net client api consuming the rest services as the simplest scenario would be to deploy .net applications together with the server. In the setups I've done native apps & html5 knockout/angular applications have used the rest api's for getting json data. You should however be able to white such a module, performing the HTTP calls and the deserializing the json without any problems.
Regards
Håkan