I am using WCF service with Winform client. I am creating a data cache by calling WCF service multiple times.
one of my service call is failing because of error...
The communication object,
System.ServiceModel.Security.SecuritySessionClientSettings
1+ClientSecurityDuplexSessionChannel[System.ServiceModel.Channels.IDuplexSessionChannel], cannot be used for communication because it is in the Faulted state.`
code block, which is throwing error...
return _wcfClient.GetGroups().ToList());
This error behavior is random. Sometimes it works without any issue and sometimes it throw given error I tired to debug the issue but client call never reach to WCF service.
Can anyont help me to understand why this is happening and how can I fix it.
UPdated question with code:
I am using casle windsor DI to resolve dependencies. that's how registering service with DI...
container.Register(Component.For<IWCFDataService>()
.AsWcfClient(DefaultClientModel.On(
WcfEndpoint.ForContract<IWCFDataService>().FromConfiguration("Binding_IWCFDataService")))
);
Then dependencies will be injected in class constructor
Code to call service
public List<string> SomePRoperty
{
get
{
lock (_lockObjectSomePRoperty)
{
return _localvariable ?? (_localvariable = wcfClientResolvedFromDI.GetGroups().ToList());
}
}
set { _localvariable = value; }
}