I have a self host service in a WPF application and a client. It works fine if the client and the service are in the same LAN, so I can send messages from client to the service.
However, I would like to know how I can consume the service from internet.
I open the TCP ports for the listing port and the mex in my router in the NAT section and I have disabled my firewall of windows (I am working in a virtual windows xp).
I am trying to use net.tcp binding, is my first option, but also I am trying with wsHttpBinding and the problem is the same, I can send message in the LAN but I can't from internet.
Perhaps it's because I don't know how to configure the address in the service or in the client, or something like that.
Thanks you very much.
Daimroc.
EDIT1: if I use the www.canyouseeme.org the can access to my service. If I stop my service then i get an error. So it looks like that the service is visible. Then why can't send messages from the client?
Since you're on a LAN, it is very likely that the machine that is hosting the WCF service is not assigned an IP address accessible from the Internet. For example, if the machine has an IP address starting with 10... or 172... or 192... then that is an internally assigned IP address.
Your machine must be set up to use an IP address assigned by a registrar and optionally, assigned a domain name (e.g. canyouseeme.org) so the Internet DNS servers can translate it to the assigned IP address.
Related
I have a wcf service (with net.tcp binding) hosted at windows service and a wpf client. when I run the service in a server outside the company's domain it works excellent, the problem is when I host the service in a server inside the company's domain, and try to run the wpf app in a client outside of the company domain.
I'm getting the same error, "The Socket connection was aborted..."
I try with Security Mode None, Transport and the same result.
My question is, what is the correct way to do that? I mean host the wcf net TCP service in a domain server and call it from a client outside of domain?
Thanks a lot!
I change the binding from net.tcp to wshttp and the service works fine!
Server with the corporate domain and client without corporate domain
The thing is I need the make this work with net.tcp
Neither a Windows Domain nor DNS have anything to do with WCF/TCP if you don't explicitly make it so.
Assuming the address you gave actually leads to the PC you host your service on (so no local IP addresses) and nothing in between (like a firewall) blocks the connection, it should work.
The correct way is to make sure client and server can talk to each other. If it's different networks, you will need NAT and if one is a corporate network I'd be very surprised to see no firewall that you need to configure.
As a first step, try to ping your target machine from your client machine.
i have hosted a wcf service in our office machine and which is being accessible from other pc in LAN. our office has static IP. so how can i access my wcf service from the out side of office if i know the static ip of our office.
now i am accessing the service from lan using this url http://192.168.6.2:7741/Services/CustomerService
if our office static ip is 122.160.187.236 then can i access my service just replace the ip address with static ip address ? please tell me all require steps to access wcf service over the internet. thanks
You will need to forward the port 7741 on the router to the 192.168.6.2 IP address.
You'll have to ask someone who has access to the router to do this.
Not sure what your environment is like but on your general router these settings will generally fall under 'advanced settings > NAT
Check out http://portforward.com/ for info on port forwarding.
Also, if you have a firewall, you need to ensure that traffic via port 7741 is allowed.
This is probably the quickest way to achieve what you want, but not the most secure. Establishing a VPN would be better but I'm not going to open that can of worms now.
Niel
it's not enough to know only IP of your network if you want access your machine from outside. Probably you should talk to administrator of your network to either establish virtual private network or assign external IP address to your machine. Actually the question related mostly to network administration and configuration, but not to WCF.
If you want to access your WCF Service from outside your LAN, from the internet, you need to assign a DNS Server outside on the internet that can assign to you a public static IP Address, because your LAN is most probably using a DHCP to lease a temporary static private IP Address. Some DNS server are free and other you need to pay a monthly fee.
I created a WCF service and hosted it on my IIS. It's working fine on my LAN, but I can't call the service from outside of my LAN network. Are there any solutions for this?
First try to ping the IP of IIS. If reply comes then try to ping the Service, as such nothing special is needed to access service out of network, only static ip must be there on the machine where you have hosted it
I can't call the service from out of my LAN network
I assume the service runs on port 80 in IIS and you're behind NAT.
You can solve this by mapping port 80 from your external IP in your router's NAT or virtual server page (see portforward.com) to the private range IP of the machine hosting IIS.
Also note the security implications of hosting a publicly accessible website on a machine, you don't want it pwned.
I've a WCF service running just on my laptop. The laptop is connected to the web, IP is static.
What's involved in getting that service consumable by a web user (say I'm in Cyprus and my clients are other in the US), can I restrict users by their IP address?
Please not, I'm aware of WCF support for P2P, but that's not what I'm looking for. The service will be migrated to a proper hosting environment after a while.
I'd let IIS do the heavy work and restrict IPs.
Restrict IP addresses in IIS
Just host the WCF inside a web project and use a dynamic DNS service to pass through to your laptop.
HTH
This service is hosted on Win2k8 R2 with wshttp binding and all security options are disabled specifically. If I assign "All unassigned IP" in binding it is working well. However if I assign a specific IP, it fails during service reference ( wcftestclient Add service option) with message like Report from 'DISCO Document' is 'There was an error downloading 'http://abcd.xxxxx.net/Management/ManagementService.svc?disco'.'.
- The request failed with HTTP status 404: Not Found.
I see that it picks the machine name though we started with http://10.10.1.1/Milestone/Milestone.svc. I checked with ping that abcd is not mapping to 10.10.1.1 but another Ip of same machine 10.10.1.2.
How can I force WCF to use IP instead of machine name? Or is there any other way to address the scenario.
If you enter http://10.10.1.1/Milestone/Milestone.svc into a web browser, instead of WCFTestClient, does that work? Switching from IP to the machine name may just be something that WCFTestClient does, but that shouldn't effect your eventual "real" clients, since they can use IP or server name.
I host my WCF services on Win 2k8 in IIS on a machine that has >1 IP, and it works fine, but in my case I bind WCF to only 1 IP address. It has been a while since I set that up, but I thought in the WCF configuration, and endpoint had to be bound to only 1 IP address. That IP should match what IIS is set to accept also. Alternatively, I think multiple endpoints can be created, one for each IP.