I am trying to write a monitoring tool to monitor some information
It will gonna work on azure normally. So i gonna host the database on azure also the webservice will be hosted at azure.
On the client's i read from the config file how many time's he need to update the information to the azure database ( with the webservice on azure ).
Now i want to send also some commands to the client itself. Like start service, .... what is the best way to do that?
How can i send it from a website that is hosted on the azure platform?
I think you should consider implementing a WCF service at the client as well. The Azure side of your software could call operations from this service when it needs to instruct the client to do something.
The WCF service at the client should be something simple,hosted in a Windows Service or in your actual client (whatever it is... win forms, console, etc).
Since you have no VPN, it sounds like you may have a problem with hosting a WCF service on the client. If the client is behind a firewall, you would have to modify the firewall configuration to allow your server to connect to this service.
Last time I had to do a service like this, I used Comet. The server maintains a queue of messages to be sent to the client. Your client connects to the web service and requests any available messages. If messages are available, the server returns them. If not, the server leaves the request open for some time. As soon as a message arrives, the server sends it down the already-open connection. The client will either periodically time out/reconnect or send a keep-alive message (perhaps once per minute) in order to keep the connection alive in the intervening firewalls.
Related
I am trying to configure a WCF service with the OracleDBBinding to get data from the Oracle db every x minutes. This polling is automated thanks to the binding configuration. This WCF service will run on a remote server.
The problem is how do I get the data that the remote WCF service obtains back to BizTalk?
Is there a particular configuration in the WCF service to enable this?
Do I just create a WCF-basicHTTP receive location in BizTalk and point the URL to the remote WCF service?
Does the remote WCF service exists with the sole purpose of polling the Oracle db and pushing to BizTalk?
I would let BizTalk poll the Oracle db directly (receive location with OracleDBBinding) and then send the data to the remote WCF service, if needed.
It would be optimal to just have BizTalk poll the Oracle DB directly, as others have mentioned. I'd push back on your infrastructure team to find a way to make that happen. However, if you truly can't get it, you could set up your remote WCF service to call out to a listener end point on the BizTalk machine. To minimize latency/communication overhead, you could use a NetTCP receive location on the BizTalk side. Set this up in the standard way from BizTalk, using the WCF Service Wizard to create an IIS application etc. - see https://msdn.microsoft.com/en-us/library/bb728041.aspx). Your intermediate service would be a client of this service. The sequence would be something like:
Remote WCF service polls data from Oracle
If data is received, it connects tot he NetTCP listener in BizTalk
It then sends data to BizTalk
BizTalk maps the data from there.
Note that this will not end up using MSDTC for the whole transaction - if your intermediate service throws an exception, BizTalk will have no awareness/insight to that, nor will any BizTalk monitoring tools you might be using. (That's part of why it'd be best to just have BizTalk poll directly.)
As far as BizTalk is concerned, this data isn't coming from Oracle, it's coming from the intermediate WCF service. You could, of course, use a schema that looks like how the Oracle adapter would write the XML - but that wouldn't be required.
This is assuming your remote service is already doing the polling on its own (using a System.Threading.Timer or something of the like) against Oracle, and you're all set with that. If you need BizTalk to fire the polling event, there's nothing out of the box that can handle that. You could try using the Scheduled Task adapter (maybe do an HTTP POST to that service?), but that seems like it'd be even more complicated and error prone to me. You could also set up a SQL polling adapter that just always returns true (e.g. having a pollingdata available statement like SELECT 1) and publishes a message that another port listens to and forwards to this service - but again, that's very messy/hacky and wouldn't be a good idea.
If you are retrieving data from Oracle for use in a BizTalk app, then you should have BizTalk Poll the data directly. Meaning, you cannot use a 'remote' WCF Service.
The oracleDbBinding supports Polling for this exact purpose.
I'm creating a WCF service (to be run in IIS) that a client can talk to. Periodically I want my server to send a heartbeat to a Master server.
At the moment the only way I see to do this is to create a second Windows Service that will send out the heartbeat.
Is there any way to get my original WCF service to run an event periodically so that I can get everything done with just one service?
Not really a good way in a WCF service
If the service is going to get some use you may be able to store the NextHeartBeat timestamp and every request check if it's time to send out a message to the master server.
What you want to do may be achieved with server push or full-duplex approaches. But for heartbeat you might get around with a simple http ping using a WebClient as described here. When self-hosting (non IIS) you can override ServiceBase.OnStart/OnStop and start/stop a timer to periodically trigger the ping.
However, hosting a WCF service in IIS usually means that your service is instantiated on a per-request basis so there is no service instance hanging around to send an enduring ping.
It depends on the purpose you need the heartbeat to the Master Server. Could you instead let the master server periodically do a request on the WCF service?
If you really are in the need for a long running service then hosting WCF in a Windows Service instead of IIS might be an option.
I am creating a client application that downloads and displays market data from Yahoo! for a university project, but that also sends out notifications to mobiles (so far using Google cloud messaging). So far it's a WPF client and the "server" is a class library - so far working. What I was wondering, is can you mix this server with a WCF service - the WCF service I was planning on using for registering devices, as well as accepting and parsing commands.
So I would call .Start() on my server object, and it will be constantly running in the background, while a WCF REST service runs alongside it - or would I be better simply having a thread running on the server that can accept input... sorry if this is confusing, but just wondering if it can, or has been done before or any advice. :)
Just to explain a bit better
The client front end and the "server" are running on the same machine - I was calling it a server because it is not only updating the front end, but sending out GCM notifications at the same time. I was wondering if maybe a WCF service could be added to make it simpler to handle adding devices to a database ("server" reads a list of device reg ids from a database, sends notifications to these) by allowing an android app to details via REST or something similiar
I would explore wrapping the class library in a Windows Service (which is essentially a process that runs continuously, and can be stopped/started/paused) and keep your WCF service as a web service for client communication.
How the WCF client service communicates with the Windows service is up to you - whether you store the data in a shared database, keep it in memory and have another WCF layer communicating between the two, etc. A shared database would be the most straightforward, especially if you want to persist the data for use by other apps/services as well.
WCF Service would be useful if you had one notification service on your server with multiple WPF client application connecting to it. If you have just one application running on the same server then not sure if it will be worth the overhead.
The usual pattern is to host WCF service in IIS, that way it always starts whenever first request is received. WCF is very flexible though, therefore you can host in in Windows Service, Console Application, etc.
I read that Signalr on Azure requires a service bus implementation (e.g. https://github.com/SignalR/SignalR/wiki/Azure-service-bus) for scalability purpose.
However, my server only makes callbacks to a single client (the caller):
// Invoke a method on the calling client
Caller.addMessage(data);
If don't need Signalr's broadcasting functionality, is an underlaying service bus still necessary?
The Service Bus dependency is not something specific to Azure. Any time you have multiple servers in play, some of your signalR clients will have created their connection to a specific server. If you want to keep multiple servers in sync something needs to handle the server to server real time communication. The pub-sub model of service bus lines up with this requirement quite well.
dfowleR lists a specific case of this in the comments. Make sure you read down that far!
If you are running on a single server (without the sla on Azure) signalR will work just fine on a Cloud Service Web Role as well as the new Azure Web Sites. I did a screencast on this simple scenario that does not take on a service bus dependency, but only runs on a single server.
In order to support the load balance scenario, is it possible to enstablish a "server to server" SignalR PersistConnection between multiple instances (ie on Azure) ?
If so, we can use a SQL Azure Table where all instances register at startup, so newest can connect to previous ones.
We want to implement a client server application. here is the scenario.
Server listens for client 24/7.
Server accept request for client and save it in DB for further process.
Once processing is done (it may take few hours), Server will response back to client.
in short , client and server listens for each other 24/7.
I want to implement it in C# but i also want that it should be accessibly from all platforms.
Also is it possible in WCF?
I agree with Yuck, this is a basic WCF scenario. There a few articles, videos and tutorials to get you started here http://msdn.microsoft.com/en-us/netframework/dd939784