Deploy/Publish Silverlight application in LAN - wcf

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.

Related

net.tcp wcf service (windows service hosted) in domain server and client outside of domain

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.

Unable to access a locally hosted wcf service over the internet

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.

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

Which port numbers to use/avoid for web services (WCF + Rest?)

I'm looking to deploy a WCF services project to IIS - the services are both wsHttp and webHttp (not that it makes much difference!) in the same project at the moment.
The server is already hosting MVC3 web sites on port 80, separate to the web services.
In the future, the services and sites may be separated...depending on load/performance/cost etc.
Are there "accepted/common" ports or port ranges to use for web services?
Any ranges to really avoid (*obvious ports ignored of course - 25/80/8080/443/1521/etc.)
If you're expecting your app to get used by folks in all sorts of environments, I'd strongly encourage you to figure out how to host it on port 80. Everything else is going to get blocked by one sort of firewall or another. About the only port that just about every company allows open is port 80.
My personal experience with this comes from having hosted a Silverlight-accessible web service on a non-standard port (port 4502, though it doesn't make much difference). Because of Silverlight's networking limitations we didn't have much of a choice, but we ran into a whole bunch of firewall issues at one company after another after another. Do yourself a favor and just host it on port 80.

Hosting WCF Service on a local machine - DNS work?

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