publishing WCF webservice in network - c#

i have a C# WCF project, i have added a websevice inside,
now i wish to publish it, so that another computer on the same network could access the service using the address http:/IPAddress:Port/webservice
how is it done?
thank you very much

Related

Expose WCF service hosted in IIS to users

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

Windows Service communication, sockets, c#

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

How to create a WCF client, that will update service reference programmatically?

I don't exactly know, how to ask this question.
I have 3 computers in my local network. On first computer I have installed windows service which hosts WCF Services (binding netTcp). So my address is "net.tcp://localhost:8523/Sms" for example.
Now, I would like to use that service from other two computers. I don't know If I have access to that WCF service - I don't how to check it.
And also I don't know, How to create a WCF client, that will update service reference programmatically?

Deploy WCF service

I need to deploy a WCF service where the user specifies some configuration data.
Let me explain: the service connects to a web server and the user should specify IP and port of that server.
How could I do it?
A solution could be to develop a tool which allows the user to create the configuration file and to "say" the service where to get it back.
So basically create installation packages with the service
and the configuration file.
Thanks
Federico
You can change the service endpoint IP address, etc. at runtime in the client program, so popping up a dialog at any point before connecting to the web service and asking the user for the IP address, etc. should work just fine, no need to jump through install package/config hoops unless you want to. Here's some code that I yanked from one of my blog posts that does pretty close to what you need:
ServiceReference1.Service1Client oneService1Client = new ServiceReference1.Service1Client();
oneService1Client.Endpoint.Address = new System.ServiceModel.EndpointAddress(
new Uri(oneService1Client.Endpoint.Address.Uri.ToString().Replace("localhost", "127.0.0.1.")),
oneService1Client.Endpoint.Address.Identity,
oneService1Client.Endpoint.Address.Headers);

Debugging Web Service with SOAP Packet

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.

Categories

Resources