Unable to access a locally hosted wcf service over the internet - wcf

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.

Related

Connect IOT module to the internet server

I have developed an IOT module which can connect to the Wi-Fi and send data to the internet, the module can send data (string) to specific IP address on the specific port.
The internet server should store that information to the data base and display that information to the user via HTTP (web page).
When I set the port to the 9081 (any random number) and my local computer IP address as IP address that module should send data to, I can see data on my local computer terminal.
My question is that how can I send that data to the internet?
What I have in mind is that I can purchase domain name, host and develop a web site (HTTP) which by default listen to port 80. The service provider only give me a basic services such as HTTP, HTTPS and FTP which make it possible to upload website and I don’t have access to other protocols and ports.
Should I purchase virtual private server or I should use any specific cloud services or the module can send data to the server on port 80 without getting conflict with web pages and web contents?
Please give me some suggestion.
I did something similar with an IoT module. There are two options that I also considered. Before we describe, there is no need to buy a domain name. You can comfortably use the IP address to connect to. If you have some spare cash go for it.
Send everything to the web server on your local computer. To have access to the local computer you must enable port 80 to be accessible over the internet. You do this on a router. This is called port forwarding. You setup a rule such that all the requests made to your IP address on port 80 should be redirected to your local computer on whatever port the web server is listening to. This is the cheapest method available. Also, there is an important limitation: you're local computer needs to be switched on all the time if you want to access the data.
Buy a droplet (virtual private server). The workflow is the same as 1, but you don't need to port forwarding anything. These are usually setup and ready to use. However, this is usually expensive. Most of these providers offer pay-as-you-go services (e.g., Digital Ocean is the one that I used). There are other providers which offer free but limited versions. These are usually developer trial versions. If you go over a number of transactions, or space, you will have to pay (have a look at Parse).

How to access my Home PC from out side by WCF service

How can i create the proxy of wcf service which runs on my home pc from out side or from my office pc. when i connect my home pc to internet then ISP assign a dynamic IP to that pc. my home pc has no fixed or static IP.
if i know my Home pc dynamic IP then can i create the proxy of wcf service which is running on my home pc from my office pc. wcf client will run at my office pc and wcf service will run in my home pc.
so this is the situation.
it would be sufficient if anyone the dynamic ip of my home pc as a result one can reach to my wcf service. so please tell me what are the information one has to acquire to reach my wcf service running on my home pc.
please give me the idea how can i run wcf client at my office which can connect to wcf service running on my home pc and exchange some data. please give me the full instruction as a result my wcf client from my office pc which can connect to my wcf service running on my home pc.
some one told me to use a common way to solve this problem is to use a Dynamic DNS, such as No-IP http://www.noip.com/. he said "DDNS services allow you to access your home computer using a fixed name, like yoursite.no-ip.org. It requires your home computer to run a small client program that communicates with the provider's servers to update the DNS records for your name whenever your IP address changes."
suppose i am not interested for No-IP http://www.noip.com/.
just give me the idea if i know the dynamic IP of machine where my wcf service is running then how can i connect my wcf client from office pc to wcf service which is running on my home pc having dynamic IP which is known to me. looking for good discussion. thanks
You need 4 things correctly setup:
Your local WCF service should be up and running: Test it from your local pc and see that it works correctly.
Your local Windows firewall have to allow connections to your port: In order to test this you shoul try to connect to your WCF service from a different computer in your home.
Your router have to redirect a given port to your local PC: Probably port 8080 of your router to port 80 of your local PC. It is done from router configuration settings.
Dynamic DNS correctly pointing to your home DSL: Probably your DSL router will have a tab in configuration that allows it to connect to Dynamic DNS service. In order to test this check that your Dynamic DNS name resolves to your
Advice: A tiny virtual server in AWS (and maybe Azure) is free and maybe an interesting alternative...
your wcf proxy that runs on your home pc, runs on a port. you will need to map that port from your router to your pc, so you can access it from outside. using No-Ip you can create a 'static' dns record that gets you to your pc
Home.No-Ip.org:1234
instead of using that, you could also just use your ip address, which is provided by your isp. note, if that is subject to change, you would need to update it everytime it changes.
assuming, you mapped port 1234 to your pc, and the correct port the wcf service is running on.
next you would need to get the client to know where the service is, so you would need to set the endpoint of the service there, the endpoint consists then of the Home.No-Ip.org:1234/someEndPointName
depending on firewall settings at your work place and your home network this should work, i do not, however, know what happens between the connection at home or work

How to connect to my apache localhost from a different network?

I am able to connect it if the two devices are in the same network but for example, if I use 4G on my android and turn of the wifi and try to connect to http://computer-ip-address then it just hangs and eventually errors out saying count not connect. The apache server is hosted in my local mac, and I've disabled my firewall temporarily. Any ideas on how to get a device using a different network to connect to my apache server on my local network?
You will need to configure your router so that it will forward port 80 from external to your mac.
Then, you can open http://your-public-Internet-ip on your mobile phone, effectively visiting your local web server.
If you don't like to remember your ip address, especially if you are on the go, the answer is dyndns or any free alternative, e.g. http://www.no-ip.com/services/managed_dns/free_dynamic_dns.html.
Using such a service, you will be able to enter http://yourname.service.com into your mobile phone. You will either have to configure your router to always tell this service your current IP (check your router for supported services) or run a tiny program on your mac which will handle this.
You need to enable port forwarding on your router to forward TCP 80 (and possibly TCP 443 if you are using SSL) to your web servers IP address.
Once done, you should be able to access your site via your routers public IP address.
Take note that of your web server is using a dynamic address provided by DHCP, your IP may change and this would stop it from working. I suggest you give your web server a static IP address to stop this.
You will probably have a dynamic IP on your router as well, so you can request a static one from your ISP or you can sign up for a dynamic DNS service.
If you post the model of your router, we may be able to give you more specific instruction on setting up port forwarding.
i hope your httpd.conf is set with port listening to
Listen 80
also, you can only access your site from your LAN otherwise, your server would need to be reachable from a public IP address, not a private one over an internet 4g connection, that means a diferent network
bonus points, if you try to reach your server from an external address, did you configure portforwarding on your router ?
If you could immediately and immediately connect to your localhost using your 4G network, then most likely anyone on the internet could do the same. It is important to understand that there are two components to the answer to your question:
Securing HTTP access (port 80 or whichever) from the internet. You probably don't want to open a wide door to your local network.
Configuring addressing from your client (in this case your phone) to your local computer (in this case your Mac). If the latter does not have a public IP address, then you will have to configure your client to hit your router instead, and to configure your router to forward accordingly.
Given that this is mostly system configuration work, I'm guessing that Serverfault would be a better place to find a satisfying answer.

Deploy/Publish Silverlight application in LAN

I have develop one simple database application build using SilverLight5.0 + Entity Framework + WCF + VisualStudio 2010 with .NET 4.0.
Database and application located in my personal PC(connected in LAN).
Now i required that this application should accessible through any computer in LAN.
Any computer in LAN can inser,Update or delete data in Database located in my personal PC through the application which i have developed what should be the simple steps i have to follow.....
please help me....
Well you're just asking how you can host your WCF service, there is tonnes of material online or any decent WCF book. You have a number of choices, from simple self hosting, windows service or IIS. Hosting a WCF service in any of the aforementioned ways is not at all complicated. Worth mentioning that since you're on LAN, you should strongly consider netTcpBinding since it has considerable performance gains over other bindings, and you don't need to worry about opening particular ports since you're on LAN.
For example you can have a service hosted in IIS on port 8085 in your LAN, the host machine has a local IP of say 192.68.1.51, now the computers in the network (on the LAN, such as 192.168.6/.7.9/etc.) can consume the service by referencing the service locally like:
http://192.168.1.51:8085/MyService/TheService.svc
Now the benefit of hosting in IIS and having a static IP (public IP) is that you can also consume the service over the internet, so computers outside the LAN can
consume the service with an address like this (if your public IP is 22.175.194.56 for example):
http://22.175.194.56:8085/MyService/TheService.svc
To do this you just need to create a rule on your LANs router to forward the
traffic coming through the port 8085 to the local IP of your service host machine (192.168.1.51), this can be configured somewhere on your routers virtual server under NATs.
Obviously if the host machines' IP changes you need to reference the new IP address to your local and outside clients, but the point of a static IP is that it never changes, for the purposes precisely.

WCF: how to consume a self host service from internet?

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.