Debug Windows Phone 7 application that contacts locally hosted WCF server - wcf

I've built a WP7 application and a locally hosted (on my machine) WCF server in my solution. I have debugged it using the emulator and it works fine, however, when I debug via device and try to connect to the server I get an exception stating that the EndPointNotFound (I'm aware I haven't set up anything to catch this exception!). Is there anyway to connect to a localhost server via the device?
Many thanks
Jonno

If you are trying to connect to your local machine from an actual device and it si not tethered, make sure that you are connected to the same local network.
What is the host name you are using to try and connect to the host machine? The emualtor will be able to resolve "localhost" to the host mahcien but your phone won't. You'll need to use the appropriate host name or IP address.

Download and install the Visual Studio SP1 tooling and host your WCF services using IIS Express. This webserver accepts incoming connections from other computers on your local network as long as there's a firewall exception to allow the connection.
You'll have to connect to the machine hosting the service through it's external IP. That cannot be localhost or 127.0.0.1 (it has to be something belonging to the same subnet).
Scott Hanselman had a presentation about the "MS Web Stack of Love" where he demos how to set all this up (using HTTPS even) and it goes into depth about how to configure the firewall and all that jazz. I recommend watching it, as he is also, a funny guy.

You can use a Wifi connection on WP7 and the local ip of your server in the config file to reference your WCF server ?

Related

Unable to connect to different HTTP port on server

I am new to WCF Services, I have developed a WCF service library hosted within a Windows Service. The service end point is http://servername:9980/ApplicationServer/ServiceName.
When I run this service on local system and try to connect using my application, everything works fine.
The problem starts when I deploy this service on server system, none of my application can use this service, even the browser says page not found. Though, if I remove the specific port number from the endpoint all works well.
I have already opened all the ports in Windows Firewall including Client and Server. Also proper exceptions are made to the router firewall, still I am not able to host the service on specific port. I have even tried by switching firewall off on both client and server system.
Thank you in advance.
-Ashish Sharma
When you remove the specific port number it defaults to port 80.
So there is something that is blocking the other port.
Try using the Telnet command to check if the port is open (you may have to enable telnet)
As you have allready checked the firewalls, it could be urlscan or a network device.

Hosting website on Azure Virtual Machine

Yesterday I created an Azure Virtual Machine using the simple Win2008r2 + SQL2008r2 image.
I have deployed a website to the VM via an RDP session.
I am able to browse the website locally (via RDP) using
"http://localhost"
I understand that I need to add an Azure endpoint for port 80 to enable me to browse to the site from an external machine.
I have configured the Windows Firewall on the Azure VM to allow traffic on Port 80 inbound and outbound.
Could anyone please advise what I've missed or what I can do to troubleshoot?
---Update-----
I have learned a little more this morning. The website that I'm trying to host on the VM is an installation of Interwoven Teamsite v7.3.x. When I looked in IIS I could see that the "Default Web Site" was stopped. Another website called "TeamSiteSitePubPreview" had been created but was only bound to port 81.
So, what was presenting the website I could see when I browsed to
http://localhost locally?
I ran netstat -ano and this showed me that PID 1604 what listening on port 80. I then ran Process Explorer which told me that PID 1604 was allocated to "Appache HTTP Server".
I know nothing about About Appache, can anyone tell me if there's some Apache config that will be preventing connections from outside of the local server?
For reference, I just tested this sequence and it gives you a website accessible over the Internet:
Create a new Windows Azure virtual machine with the Windows Server 2008 R2 SP1 image.
Add an endpoint on public port 80, private port 80.
While the endpoint is being created, start setting the server up.
Remote Desktop in.
Add the Web Server (IIS) role with default settings.
Test the connection. You should get a HTTP 200 OK status.
If you want to troubleshoot your server, start checking for errors in the event log. Check also the website bindings in IIS (Port 80, IP Address *).
Also consider the connection issue might be on the client (your) side. For instance, DNS caching. Try connecting from another machine with direct Internet connection (such as another cloud server) or from a service such as isup.me.
Additionally, if all you want is to host websites in IIS, the Web Sites service has a more streamlined experience.
You will need to create an endpoint on port 80 thru Windows Azure Management portal as well. This endpoint opens a port in the Windows Azure Load-balancer.
Navigate to your VM within the portal and create a new Endpoint under the Endpoints screen of VM configuration within Azure management portal.

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

Serial port communication with Apache Web Server

I'm trying to deploy a web application based on ASP.NET to Apache/mod-mono
The application is for my personnal use only as it is not safe at all : I have to access to a serial port of the web server !
When I run my application on windows (with the server in VS2010), everything is going great, I can have access to the serial port and communicate through it, but things are going bad when I try it on a Apache server. My web application has a proper behavior, but I get an Internal Server Error when I try to access to the serial port.
I think the problem comes from a lack of permission for the server to access to the serial port, but how can I overcome this issue ?

How can I Publish my WCF Service?

I want to use my webservice on internet. I opened my port which is 4501 an I disabled firewall on modem and on windows. I can write my global ip and I can open modem control inteface. But I want to connect to iis which address is xx.xx.xx.xx:4501/Products.svc
It works on localhost (http://localhost:4501/Product.svc) But I cant connect to svc on internet ..
I dont know where is problem.
When I add my svc link addres as adding reference service I got this error
There was an error downloading 'http://xx.xx.xx.xx:4501/Products.svc'.
Unable to connect to the remote server
Hedef makine etkin olarak reddettiğinden bağlantı kurulamadı xx.xx.xx.xx:4501
Metadata contains a reference that cannot be resolved: 'http://xx.xx.xx.xx:4501/Products.svc'.
There was no endpoint listening at http://xx.xx.xx.xx:4501/Products.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Unable to connect to the remote server
Hedef makine etkin olarak reddettiğinden bağlantı kurulamadı xx.xx.xx.xx:4501
If the service is defined in the current solution, try building the solution and adding the service reference again.
And One point more,
If I start to IIS, wcf service doesnt work even in localhost. If I start it in Visual Studio (I mean asp.net development service works) it works..
IIS version is 7.5.7600 and I added application pool as Asp.net 4.0
Is there any specific reason you use port 4501 for HTTP in IIS?
Visual Studio 2010 WebDev WebServer (Cassini) uses random port number (4501 in your case) to simplify configuration. It assumes that port 80 can be occupied by its big brother IIS or any other software.
That is fine for development in local machine but there is no need to use the same port in production.
Default HTTP port is 80 and it is usually the most open open port in networks.
Use port 80 for HTTP traffic in IIS and your life will be much easier.
P.S. Did you try http://xx.xx.xx.xx/Products.svc? Port number is part of web service configuration and it is not copied when you move app to IIS. It is possible that IIS already uses default HTTP port.