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.
Related
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).
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.
So this is the issue:
I have a .NET project that includes 5 Web Application Layers.
One of them is API.
I Recently added a Cordova project as well and I'd like it to communicate with the API Layer.
Is there anyone who knows what to do?
P.S.:
I use visual studio 2013.
You can use normal jQuery Ajax calls to make requests to the API. http://api.jquery.com/jquery.ajax/ or just normal JavaScript ajax https://stackoverflow.com/a/8567149/487940.
I hope that answers your question.
If you're talking about calling into Web API web services from a Cordova app, you may find the Breeze.JS framework useful to help you. You can either just used the client library or use some server side code in addition to client code to help get you up and running and exposing new web services as well.
Otherwise it is simply a matter of making web service calls to the server from your JavaScript code but the specifics will depend on exactly what you're trying to do and what client UI/utility framework you are using.
Objective:
We have a Windows Service/generic EXE that also hosts a WCF service (.Net 3.5). I'd like to be able to take a third party ASP.NET component in a DLL, and host it through that WCF Service.
Is this possible to do, in any way?
It seems like if you want to host a ASP.NET app, it must be through IIS, but we don't use IIS.
Is there any way that we could load the ASP.NET app into memory, make the app available through an endpoint, and receive requests back from the app?
Specifically, we'd like to take the "Microsoft.ReportViewer.WebForms.dll", expose the web form in a web page, and accept any requests back from the web form.
http://msdn.microsoft.com/en-us/library/ms251723.aspx
Looking for anything to get me started. Thx.
From owin.org
"OWIN defines a standard interface between .NET web servers and web applications. The goal of the OWIN interface is to decouple server and application, encourage the development of simple modules for .NET web development, and, by being an open standard, stimulate the open source ecosystem of .NET web development tools."
Essentially Owin implementations, like Katana (OWIN implementations for Microsoft servers and frameworks.), help you self host web apps, even in a Windows NT Service.
According to this post, hosting a WebForms app outside IIS/ASP.NET is not possible.
WebForms are tightly coupled to ASP.NET/IIS and cannot run directly on
OWIN/Katana (e.g. outside of ASP.NET/IIS). However, you should be able
to use Katana's middleware (Security, CORS, etc.) in a WebForms
application.
http://katanaproject.codeplex.com/discussions/571291
Is it possible to write a simple custom Console Application that includes a owin library that can host a Asp.Net Web Application directly (without katana.exe, like CassiniDev's library)?
Is it possible to let an Asp.Net Web Application including MVC 4, Web API, SignalR features hosted across IIS and owin, without / rarely changing code?
For hosting applications from the ASP .NET framework family on top of OWIN, as of this post, you can do so with WebAPI and SignalR. If you need something more like MVC and Razor, you can look at using the NancyFX web app framework for that. Maybe in future versions of MVC OWIN support will be enabled
I did an initial implementation of adapter at https://github.com/ashmind/Gate.Adapters.AspNet.
It is absolutely not production ready, but if the functionality is important for you you are welcome to test/extend it.
As far as I know there is no other reliable library for that.