SignalR Core client on ASP.NET Framework server - asp.net

I have an existing application running .NET Framework 4.6.1, that uses SignalR version 2.3. The client version I'm using is 2.0, this has a jQuery dependency. This current setup uses SignalR cors as my web front end is on a different domain to my backend services which is where my hubs lie. To be honest it's all working fine and I'm happy with it, even though you could say it's old tech.
This application has been rewritten relatively recently, but at the time the project was started, SignalR on .Net Core didn't exist, or it might have been in alpha so it wasn't considered an option.
I now have the need to add a new project to the solution, a front end dashboard. Where I work, for new development we use angular, and .Net Core. I thought this would be a good opportunity to try to introduce these new techs into the solution. The plan is to have an angular project and use the #aspnet/signalr npm package, I'll be using Typescript.
Now, the problem (if you haven't guessed already). I can't seem to get my new shiny SignalR client to work with my old Framework SignalR server. The error message is very specific when the call to SignalR is made:
Error: Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server.
What are my options here? Am I going to have to upgrade the SignalR project and the projects that interact with SignalR to Core? Or is there something else that I can do I the meantime to give me more time to upgrade?

You have to use the Asp.Net Core Server with Asp.Net Core Client or use Asp.Net SignalR Server with Asp.Net SignalR Client. You cannot mix them, they won't work together.
Not sure of any work around for that. Checking the differences page it does say you can run CORE on .NET Framework 4.6.1 or later .NET Core 2.1 or later. You should still be able run Asp.Net SignalR on a server running .NET Framework 4.6.1 if that is available to you (yes, I know you said you are a angular/core shop).
Short of that... yes, you would need to rewrite your app for SignalR Core (server and client).

Related

Can I use ASP.NET Core SignalR Javascript file in my .NET Framework Web appplication?

I have a Web application that uses the .NET Framework. I created a separate ASP.NET Core web application to use as a SignalR server.
In the .NET Framework web app, I followed the Microsoft tutorial on adding the Javascript client libraries (#microsoft/signalr#latest).
The chat application is working, but then I saw this statement "ASP.NET Core SignalR isn't compatible with clients or servers for ASP.NET SignalR." Link
I get that there is no backwards compatibility, but is this also saying that if your application is using the .NET Framework, you must use ASP.NET SignalR for both client and server?
I found this SO answer which seems to indicate that it is okay, but I'm not sure what he means by "normal System.Web" pipeline.

Can "old" ASP.Net SignalR be used in ASP.Net Core 3.x app?

You might ask why I would want to use old SignalR in ASP.Net Core. Well, I have an old MVC 4 app that I cannot completely rewrite and want to use it in conjunction with a new ASP.Net Core 3.1 app with the 2 apps potentially communicating via Web API and SignalR. Since ASP.Net SignalR is not compatible with Asp.Net Core SignalR I would need to run ASP.Net SignalR in my ASP.Net Core app. If this is not possible, then I certainly could not write the new app in ASP.Net and not ASP.Net Core. Just trying to understand possibilities.
After a little further work, I don't believe that this is possible

Sharepoint Provider Hosted Add In using .Net Core application

I am currently attempting to take an application that I have already created as a .Net CORE Application and connect it to Sharepoint Online in the form of a Provider Hosted Sharepoint Add In.
It seems that Sharepoint add ins can only recognise .Net Framework web applications which would result in having to port the .Net CORE application to a .Net Application.
I am seeking the easiest and cleanest way to proceed with this.
Is there a way that I can create a Provider Hosted app using .Net core or should I port the .NET Core application to a .Net Framework web application?
If so, how would you go about doing this?
Even we were trying to achieve the same thing. But we ended up in .net framework. To be on the safer side, you can create a provider hosted app using visual studio, which gives better connectivity to the Sharepoint App.
.Net core to .Net framework conversion would be so simple, since the framework holds most of the libraries and functionalities when compared to .Net core. You can just copy paste the code from your.net core and you can do modifications to fit in the framework.
Otherwise, you can use oauth tokens by using SharePoint Rest API's. If you have already built the provider hosted app and installed it in your site collection, you can just use the existing client id, client secret to get the access token like this. So that you can perform everything using your existing .Net core app.

Service Fabric reliable service with .NET Core

So I am playing around with Service Fabric for rolling out a system to the cloud, and so far I have most of the stateless services ported over and running well using ASP.NET Core.
I have another set of services that need to be stateful, and I would like to leverage .NET Core for those services as well. For those I will need to run a custom TCP protocol, not HTTP/WebAPI/WCF.
So the question is; is this possible? The templates only have a ASP.NET Core stateless service template. Can I build something like a .NET Core console application to run as a "Reliable Service"? If so, is there any documentation on how to do this?
Yes, it's possible.
You can create the .NET 4.5.1 stateful service via the template, and then port that project to .NET Core - we've done this and it works just fine.
There doesn't appear to be any official documentation on this process.

Signalr broadcast from web api

What is the best practice to SignalR broadcast from webapi which is located in another project to mvc application when you install signalr package in the mvc application?
MVC - localhost:8080
API - localhost:8080/api (lives in a different project)
Hubs - Shared class library for Hubs
The problem is, if i install signalr package in MVC application, it doesnt work, but if i install it in API application, it then works.
Any ideas?
You don't need hubs to be shared, hubs are necessary (if you use the Hubs API) only to the broadcaster. You can remove their usage from the MVC project.
Moreover, you do not need the full SignalR package in both. The WebAPI will hardly have its own JS clients (they come from the MVC one), so it is enough to install just the SignalR .NET client library. Same reasoning on the MVC project, that is just a client from a SignalR perspective, so you just need to install the SignalR JS package. I'm assuming you are broadcasting from WebAPI project directly towards the MVC users in their browsers, however if you are trying to achieve a server-to-server broadcasting then you'll need the .NET client library there too, but still no need to share hubs.

Resources