The communication object, System.ServiceModel.ChannelFactory`, cannot be used for communication because it is in the Faulted state

Viewed 1029

I am using .net core 3.0 and consuming WCF service in my application and getting error message when Using(OperationContextScope scope = new OperationContextScope(client.InnerChannel)) gets executed

 Try
 {
 using(OperationContextScope scope = new OperationContextScope(client.InnerChannel))
                    {
                        HttpRequestMessageProperty httpRequestMessage = new HttpRequestMessageProperty();
                        httpRequestMessage.Headers.Add("apikey", apikey);
                        OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestMessage;
                        await client.OpenAsync();
                        var result2 = await client.ProcessRequestAsync(reqedata, partner);
                        var data = result2;
                    }
                    }
catch(Exception e)
            {
                throw;
            }
Exception : {"The communication object, System.ServiceModel.ChannelFactory`1[Service.IMarketSoftware], cannot be used for communication because it is in the Faulted state."}

I do not understand why I am getting this error. Can please anyone help me with this?

0 Answers
Related