Simple story,
I made a server using WCF, now I want to move the server to a different location. When moved client applications needs to be reconfigure the service they are listening because the ip is not the same. Can you automate this, when the server is moved all applications listening to it will autodetect the new location and address of the server.
You need to use WCF 4 and auto discovery feature. Here is a nice link that give you the first steps
Use WCF 4 Discovery.
http://msdn.microsoft.com/en-us/library/dd456782.aspx
Related
I have a server physically located in the US. The OS is Windows Server 2008 R2 SP1.
I create a WCF service and host it in IIS on the server.
Now, while I'm physically in Germany, I want to write a WCF client to the WCF service. First of all, I need to create a WCF client proxy.
All the tutorials I've seen imply that the WCF service and WCF client are located on the same machine. I.e., the tutorials use "localhost" everywhere. In my case it doesn't work.
I know the IP of my server but I don't know what settings should be done to allow any programmer to use the WCF service. I guess it requires special customization of the endpoint at the WCF service and some settings at the IIS to make the WCF accessible by anybody.
Can you please give a piece of advice in this regard?
Thanks for any suggestions!
Two approaches are available :
Create a service reference using the add reference , enter your service address should be something like : http://IpAdress/service.svc , or if you have your wsdl file on your local disk , just enter your wsdl file location in the add service address bar. This will generate the proxy class.
If you have the service contract(interface) just do it programatically using ChannelFactory , you must know your binding and endpoint address as well.
If have any questions you're welcome
I need to call a WCF service that is behind a DMZ:
WEBDMZ .. LANDMZ
------------- ------------
ClientServer => WCF service
As there is a firewall between the two it's not possible for the Client to connect to the WCF service. So I need the WCF service to connect to the client and "listen" to connections or create a tunnel somehow.
I feel it must be a very common problem but I haven't been able to find a proper solution yet. And no it's not possible to open a port. The connection have to be initiated by the WCF.
The client is a server and can easily host any MSMQ or other service.
It seems like this problem can also be referred to as "reverse proxy" or "reverse tunnel".
Solution ideas:
MSMQ hosted by Client (but I'm afraid if it would just simply be polling all the time and creating a network overhead).
A reverse tunnel/proxy?
WCF Duplex?
I'm looking for the simplest solution, preferably in C# and without 3rd party software. Perhaps there is a WCF configuration that allows for reverse calls?
With .Net version 4, you can look at WCF Routing service at here. Or you can build a routing service by yourself following example from Michele Leroux. Here is the link.
EDIT:
You can build a routing service, put it at WEBDMZ server, it will contains list of endpoint wcf service put at DMZ server. At here it will take role as a service server as well as client connect to services at DMZ server. You also can build a discovery service to configure these endpoints automatically.
i'm writing a server side application and a windows service which need to be installed on a remote host
the service returns CPU usage to the serverside application - this is NOT the problem
the serverside application deploys the service on the remote host. - also, not the problem
THE PROBLEM:
but how do i setup a socket connection between the two, when i dont want to hardcode the ip address? (for scalability) - do i need to use multicast or is there some devious way of doing this? is there another solution than using sockets? -
i'm new to writing Windows Services.
I need help figuring out how to communicate between the server and the service without hardcoding IP-addr.
thank you in advance.
MY SOLUTION:
I created a windows service, that reads a xml file with the IP and port of the Server application. so when i deploy my client application, i also create a xml file with the network information.
Regards Alex
A lot of communication platforms now use network discovery; there's an article on codeproject that goes into detail about using network discovery.
The problem was, I did not know what machine name the server was running on, in fact I wanted this to be flexible, and selectable by the user.
Seems relevant to http://www.codeproject.com/Articles/16113/Retreiving-a-list-of-network-computer-names-using
Have you thought of using WCF?
http://msdn.microsoft.com/en-us/library/ms731082.aspx
Regarding multicast, you can have a WCF server multicast announce it's availability on a network; see http://msdn.microsoft.com/en-us/library/dd456782.aspx
another solution could be to create the service as a console application with arguments (endpoint ip address) and then just deploy it with the arguments on the remote host
I need to write an application that acts as a proxy between a client and a service. All I want to do is read the data that is traveling in both directions from client to service and vice versa. In essence I want this proxy to be able to be just plugged in without the need to reconfigure port settings in either the client or the service. Is this possible? Is there any specific library I could use in the C# .Net framework that will help?
EDIT: The service is on a remote machine.
EDIT: Example: Lets assume that the client is communicating to the service via port 1234 and the service is communicating to the client via port 5678. I want the application to listen and read the data traveling through these ports without actually reconfiguring either the client or the service. Is that possible?
If you are to read/listen/capture the data then it does not need to be a proxy. I would recommend WinPcap library (http://www.winpcap.org/). Although it's a C/C++ library, I don't think it's hard for a C#/.NET application to make use of it.
If you wanna redirect the ongoing connection as soon as your proxy program is up, the short answer is hard, really hard and impossible. As far as I've known, once the connection between 2 ends is established, no way you can change it (unless you have access to the router and modify its NAT on the fly, like a load balancer...). If you just want to read & not to modify the traffic data, use WinPcap or any packet sniffer. Either of these solutions are quite expensive to implement in term of money and technical work :)
Because you didn't give us what you actual wanna do, I assume that you don't need that "much" complexity. Here a solution just in case you meet the following prerequisites:
The client connects to the service via a domain name, not an absolute IP and vice versa. This is important because we are going to change the DNS in the host file to "fake" the end-point servers to our proxy server address.
You have access rights (administrator) to the client machine & the service machine to make any change.
Then what you should do next is to:
Change the IP of the hostname of your service server on your client machine to the IP of the proxy server. This just changes the result of the OS DNS resolver. Do the reversing way for the service server.
Drop & re-establish connections between 2 client machine & service server. Now, each connection is properly "proxied" via your proxy server.
Ha, quite intricate but it works I think... Hoping someone has better solutions for this situation and I'm looking forward to hearing that.
I have a web service that I created in C# and a test harness that was provided by my client. Unfortunately my web service doesn't seem to be parsing the objects created by the test harness. I believe the problem lies with serializing the soap packet.
Using TCPTrace I was able to get the soap packet passed to the web service but only on a remote machine so I can't debug it there. Is there a way of calling my local webservice with the soap packet generated rather than my current test harness where I manually create objects and call the web service through a web reference?
[edit] The machine that I got the soap packet was on a vm so I can't link it to my machine. I suppose I'm looking for a tool that I can paste the soap packet into and it will in turn call my web service
A somewhat manual process would be to use the Poster add-in for Firefox. There is also a java utility called SoapUI that has some discovery based automated templates that you can then modify and run against your service.
By default, .Net will not allow you to connect a packet analyzer like TCPTrace or Fiddler (which I prefer) to localhost or 127.0.0.1 connections (for reasons that I forget now..)
Best way would be to reference your web services via a full IP address or FQDN where possible. That will allow you to trace the calls in the tool of your choice.
Same as palehorse, use soapUI or directly the specific component for that feature: TCPMon.
Just did this the other day with TCPTrace on the local machine. I mapped the remote host in the hosts file to 127.0.0.1. Ran the local web server on 8080, TcpTrace on 80 pointing to 127.0.0.1:8080. Probably your issue is trying to run both at port 80 which won't work.