vb.net client server - connect to desktop app from website - asp.net

Tools : VB.net (VS2010), MySQL
I've a client desltop application connecting to my asp.net (vb) website. The desktop app typically sends a request and web app (server) responds to it.
Now, for certain scenarios, I would like website to connect to the client app and sends some data. How do I do it ?
I know client-server app (desktop app to desktop app) but not sure whether this can be done from website to destop app.
Any help is appreciated. Thanks.

You could use SignalR Framework.
From asp.net website : "ASP.NET SignalR is a new library for ASP.NET developers that makes developing real-time web functionality easy. SignalR allows bi-directional communication between server and client. Servers can now push content to connected clients instantly as it becomes available. SignalR supports Web Sockets, and falls back to other compatible techniques for older browsers. SignalR includes APIs for connection management (for instance, connect and disconnect events), grouping connections, and authorization."
Have a look here for documentation and tutorials : http://www.asp.net/signalr

Related

Using ASP.NET Web application as SignalR client

My team is in the middle of deciding the architecture of our backend system:
Webserver A is an ASP.NET MVC application with ASP.NET Web API component, hosted in Azure Website.
Windows Service B is a self-hosted OWIN server that will periodically push notifications to clients who subscribes to the notification, hosted in Azure VM.
Windows Service C is a client that subscribes to notification from B, hosted in Azure VM.
Since we are more-or-less entrenched in .NET stack, we implemented B as SignalR server with C being the SignalR client. This part seems to work well.
Now comes a point where we also want A to subscribe to B, but I realize that it means an ASP.NET Web Server is going to act as SignalR CLIENT, instead of the typical scenario where it acts as SignalR server.
I presume we can initialize the SignalR connection in Global.asax and make the process ever-running to avoid AppDomain recycle. However, I feel a bit iffy when a Web Server is made to do something other than serving web requests. This solution also make the web server not stateless since it needs to maintain the web socket connection alive.
Is there something fundamentally wrong with making an ASP.NET application a SignalR client? Is there any possible gotcha with this setup?
In Azure you cannot tell that your AppDomain will not recycle. Because of many reasons, it can restart itself to heal and then you will end up making a new connection to the SingleR server. Is that OK for you?
Also SingleR is mostly used in the Web Functionality improvement where polling and refresh on web clients is made simple. But as your requirement seems to be all a back end stuff, I would suggest you to go with any other event driven pattern. Check Azure Service Bus topic/subscription model to have different components listen to various events and act accordingly.

is it possible to control a desktop application by a web application

I have developed a desktop application in c# which send SMS by using an api, It has two button controls 'Send SMS' and 'Stop SMS'. This application is running on a Microsoft SQL server 2008 R2 and I have assigned an Static IP also.
Now my question is that, can I access this application using a web application, means can I control both buttons functionality over web site if I create one and host is from the same server?
Yes. You can make your application to listen spesific port and your web app can send requests to that IP and Port.
As Mike said, actually you should be able to reuse the business logic codebase of your Desktop-Application.
But if this is no option, you also could use named pipes for communcation between the several processes, where you desktop application would be the server, that the wep application would connect to.
May have a look at here:
http://msdn.microsoft.com/en-us/library/bb546085(v=vs.100).aspx

SignalR architecture - central or distributed hubs

Suppose I have 3 applications -
WebApp 1 - a NancyFX app that serves html pages. there's also a SignalR hub for messaging communications between the users of that app. (and sends messages to WebApp2 sometimes)
WebApp 2 - a NancyFX app that serves html pages. there's a SignalR hub to that receives messages from WebApp 1 and updates the users of WebApp 2.
WebApp3 - a self hosted WebAPI that doesn't have a SignalR hub, but sends messages to WebApp2 in order to update it's connected clients.
So my question - is keeping two hubs in WebApp2 and WebApp1 the way to go, or should I have a (scalable) dedicated SignalR server which hosts the hubs of WebApp2 and WebApp1 to facilitate communications?
Thanks..
Tough to say what's best for you, since we have no details about your load requirements or how authentication/authorization works in your application. However, I'll say this:
Your scenario could be viewed as similar to a more typical SignalR scale-out situation, where you have a single application deployed to a web farm behind a load-balancer. In this scenario, you use SignalR's scaleout ("backplane") feature for server-to-server communication so that outgoing messages reach clients no matter which server they happen to be connected to. Your situation is really no different, except you have three different applications in play. As long as all three of your applications are hosting the same hub class (via a shared hub assembly) and are connected to the same scaleout backplane, it ought to work fine.

SignalR Persistent Connection Between MVC Server and a Windows Service?

I have a use case where we will have an ASP.NET MVC Server Application but it needs to talk over a persistent connection to a Windows service. It doesn't look like SignalR does this as it really wants talk Server to JavaScript browsers but I did notice .NET desktop libraries. Can it talk from a server to a Windows server? If not, is there a recommended way, TCP/IP or HTTP to have a persistent connection between the two? NetTcpBinding in WCF?
Yes, there is a SignalR client library for .NET that you can use in any old .NET app to talk to a SignalR server just like you can from JavaScript.
While there is a WebSockets binding for WCF, there is no binding that actually talks native SignalR which adds its own message framing on top of raw web sockets. So, while possible, it doesn't exist today and I wouldn't hold my breath for it ever being created.
Why not simply have a queue using RabbitMQ. And anytime the web need to talk to window service, it push a message into the queue while the window service listen to the queue

send popup in desktop application from asp.net web page

I have a web application and on that application i update a sql database ...what i want is that when i update the database from the web application a notification will be sent to any one openening my application or a pop up appears to them on their desktop informing them that the database is updated to check all this will be in an intranet.
I'm using ASP.Net and I'm the admin for all the PCs in the network and the server.
Does anyone knows how i can do this ?
Build a desktop application that polls the database regularly or better write a HTTP/REST service where desktop application poll frequently.
What you need is a WCF duplex service your website and your windows clients connect to. With such a service you can use callback methods to inform your windows clients through the service. But be aware that this is normally an intranet and not an internet scenario because such an wcf binding has problems with internet infrastructure (Proxies, Firewalls, ...)

Resources