tags:

views:

606

answers:

2

Hi All, I have a client app and a server app. The client calls a wcf service and passes machine information to server , based on the machine name the server calls back a wcf service on client side. So to achieve this , I am just changing the EndPointAddress but then it's throwing NoEndPointFoundException , how can i fix it , below is the code : public void RegisterTasks(MachineConfig machineInfo) { string add = exeProxy.Endpoint.Address.Uri.Scheme + "://" + machineInfo.MachineName.Trim()+"/" + exeProxy.Endpoint.Address.Uri.Segments[1];

        Uri uri = new Uri(add);
        EndpointAddress eadd = new EndpointAddress(add);
        WSHttpBinding whttpBinding = new WSHttpBinding(SecurityMode.None);

        //ServiceReference1.ExecuteTaskClient newProxy = new ExecuteTaskClient(whttpBinding , eadd);


        //EndpointAddress endPointAddress = ;

          exeProxy.Endpoint.Address = eadd;
          //exeProxy.Endpoint.Binding = new System.ServiceModel.BasicHttpBinding("httpBinding");

        // we just execute the task by 
        // calling the wcf service on client side
        foreach (Task  task  in machineInfo.Tasks)
        {                
            exeProxy.ExecuteTask(task.TaskID);
           // newProxy.ExecuteTask(task.TaskID);
        }

    }
+1  A: 

I am assuming that you are getting EndpointNotFoundException not NoEndPointFoundException. I could not find a reference to NoEndPointFoundException.

http://msdn.microsoft.com/en-us/library/system.servicemodel.endpointnotfoundexception.aspx

What this is saying is that the client cannot find the server. In your case the server is trying to call back to the client, so the roles are reversed.

There are two things that could be wrong:

  • the url that you have in the variable "add" is incorrect (try logging the value)
  • the wcf service on the client side is not listening on the correct url (try putting the url in a browser)

Hope this helps

Shiraz

Shiraz Bhaiji
A: 

My first impression is that your design should be reconsidered. Any time I see an ingenious (read: bizarre) solution I see a whole heap of head banging in the making.

So firstly, write out what it is that you are trying to acheive in baby speak: "I want client to be contacted when server has new data." and then think about how it can be acheived using more conventional techniques.

Check out the duplex bindings - and polling a stateful singleton is not always a bad idea if you're not scaling into thousands of clients -- in fact, I bet it'd scale better than your current design.

But, to solve your current design issue, I'd setup the client (which will become the server) with the MEX endpoint (mexHttpBinding) and then set it off so its listening, then use VS (an empty project or from the server project) to try and connect to the client(server) by way of Add Service Reference and supplying the local machine name etc. This alone might turn up your problem. Then once added, you can use the autogen app.config to know what settings you need.

Also, have you considered how the server will be able to call the client if the server doesn't have the proxy classes setup?

It does sound like you're making a rod for your own back.

Luke Puplett