0

I try to implement WCF Discovery service using multithreading.

static void InvokeService()
{           
        var Services = discoveryClient.Find(new FindCriteria(typeof(WCFDiscoveryContract.IService1)));
        discoveryClient.Close();

        ServiceClient.ServiceReference1.Service1Client client = new ServiceClient.ServiceReference1.Service1Client();
        client.Endpoint.Address = Services.Endpoints[0].Address;
        var loanResponses = new MultiThreadedServiceCall<IService1, int, string>()
                        .CallMethod((service, request) => service.GetData(request))
                        .AttachService(new ServiceClient.ServiceReference1.Service1Client())                            
                        .GetResults(111);  
        string ss = client.GetData(1);
        Console.WriteLine("Data is " + ss);
}

When i discover a service hosted in the same machine, it is working fine with the output. But when i use the service hosted in another machine in the same network, it throws error in the following line.

string ss = client.GetData(1);

Error is

SecurityNegotiationException was unhandled

The caller was not authenticated by the service.

The request for security token could not be satisfied because authentication failed.

I use wsHttpBinding.

Please note wcf discovery service is working fine for service hosted in another machine.

senthilraja
  • 167
  • 2
  • 11
  • What security mode do you use? – Tony Feb 17 '14 at 06:25
  • i didnt use any security mode. – senthilraja Feb 17 '14 at 06:40
  • You mean you set it to none? `` ? – Tony Feb 17 '14 at 06:42
  • i didnt specify tag itself. when i use this i am getting another error. Error: The message could not be processed. This is most likely because the action 'http://tempuri.org/IService1/GetData' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding. – senthilraja Feb 17 '14 at 06:54
  • Can you make the call single threaded? – tom redfern Feb 17 '14 at 09:20
  • in single thread also, i am getting Error: The message could not be processed. This is most likely because the action 'tempuri.org/IService1/GetData'; – senthilraja Feb 18 '14 at 05:44

0 Answers0