WCF Client Proxy C# How Can I Change User on the fly? - c#

I have a WCF DUPLEX Client Proxy that connects to a Service - I control both sources of code. I would like to know how I can change the user on the fly. So for example my client application starts up, it has data that gets updated because it has connected tot he WCF service which the singleton service host pushes data to it. I would like to be able to have the User of the Client Application to be able to change and the proxy that is already communicating to change its connection to use those credentials. (The proxy is running ) ; is this possible and if so how would I implement it ?

Related

Are WCF + Callbacks suitable for sending commands to the client?

I'm trying to create a WCF service for our existing product.
The service should provide normal "webservice" features (one-way), but also act independently.
Sample scenario:
The client connects to the server
The server saves the client in a collection
Now I use an admin client / database entry to tell the client to do sth. (For example change config for log4net/NHibernate)
I've read some things about callbacks (mostly a chat system), but I'm still not sure if this will work.
Now my question is, will WCF be suitable for such a scenario or should I use TCPClient/TCPListener?

How to control application via webservice

I want to control application (in my case it is corelDraw) ,I know I should use it's application object and I do this, but the issue now is I want to do this in webservice,
so as far as I understand if I put this code which control the application in the web-service ,my code will try to control the corel application which is on the server not on the client :(
so any hint/advice how could I do this, and control the application on the client not server ?!!!
As you already noticed web service runs on server and only result is passed to client.
Well you have a few options to control client machine over web service... Here is one of possible scenarios.
1. create web service that will provide commands for client
2. create windows service (client) that will consume your web service commands
3. inside windows service then just execute those commands in appropriate manner
Well I have to say this is not the prefered way I would take to automate corelDraw, but if you insist on using webservice as command provider it will do the job.
You need to ask yourself what is the difference between client and a server. Can a client be a server? Can a server be a client?
You make your client with CorelDraw installed to accept web-service request, i.e. effectively make it a web-service server, and then carry on as normal.
Although I would say web-service is not the best way to control such complex application as CorelDraw. I'd look in some other ways of communication between peers, like lower level network communication that would not have overhead of HTTP.

Send commands to another network

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.

Communication Between WCF Rest Service and host application

I have a WCF Rest web service that I am hosting in a managed application. What I would like is for client input to the service to be passed to the host application for processing, and the results are then passed back to the client. From similar questions like here and here I know I can use events to pass the data from the service to my host application. However, I cannot seem to figure out how to get the resulting data passed back to the client. Is there a way to do this using the webOperationContext or perhaps by creating another event in the host application to pass the data back to the web service?

C# Get the Client Application Checksum from the WCF Service

We are using WCF Services that transfer some data from a Client Application to the Server Application (WCF Service). This last one will apply an algorithm using these data and send back the result to the client.
We would like to authenticate the Client Application from the Server WCF Service. Would it be possible to get the Client Application Checksum directly from the WCF Service?
We are already using wsHttpBinding but we would like to add one more layer on the client application integrity.
Appreciate for your help,
Camille.
he WCF service can't get anything from the client unless the client sends it to the service. So if you can get your client to send your service the checksum (as a method parameter), then you're in business. WCF is not magic. Nor is any "service" technology for that matter. It is a simple tcp/ip communication between a client and a server. On both side, the only information that goes across is the information each side decides to send, nothing more.

Categories