Search code examples
wcfcompact-frameworkwcf-client

WCF service called from compact framework


I have been trying to follow this article on communicating with a WCF service from a mobile device (using compact framework 3.5). I have the service running on the desktop, and it tells me that it's running as:

http://localhost:1414/MyService.svc

I can see this in my client, but when I try to access it, I get this error:

There was no endpoint listening at http://localhost:1414/MyService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

So I did:

InnerException: {"No connection could be made because the target machine actively refused it"}

I am running from the emulator, which the article states did not work - I therefore suspect that I have encountered the same issue. So my question is, does anyone know why this issue may occur?

EDIT:

Just to clarify, this works fine when deployed to the device. It's just the emulator that has the problem.

EDIT:

Thanks to @Shiraz Bhaiji I have made some progress with this now, but am now getting the error returned:

CFFaultException

This seems to be the only error information I can get, and it's caused by the call:

MyServiceServiceClient client = new MyServiceServiceClient(binding, endpoint);    
returnString = client.MyFunc1();

I have changed the endpoint to reference my I.P. address directly as follows (the WCF service is running on my PC at the minute):

Binding binding = MyServiceServiceClient.CreateDefaultBinding();
string remoteAddress = MyServiceServiceClient.EndpointAddress.Uri.ToString();
EndpointAddress endpoint = new EndpointAddress("http://1.1.1.1/MyService/MyService.svc");

Solution

  • Check Eric Schneider's answer on this link: http://social.msdn.microsoft.com/Forums/en/netfxcompact/thread/b5be4c83-40ca-423b-9068-8614779fed5f

    Connect to the server using the IP address.