Question: I'm getting this error:

> 
> The communication object,
>  System.ServiceModel.ChannelFactory`1[FxCurveService.IFxCurveService],
>  cannot be used for communication because it is in the Faulted state.
> 
> 
> 

When I call this code:

```
using (var client = new WCFServiceChannelFactory<IFxCurveService>(new Uri("http://ksqcoreapp64int:5025/")))
                {
                    guid = client.Call(svc => svc.ReserveSnapshot(fxCurveKey));
                    DiscountFactorNew[] dfs = client.Call(svc => svc.GetDiscountFactors(guid, dates, from));
                    Assert.IsTrue(guid != null);
                }

```

It errors here - `client.Call(svc => svc.ReserveSnapshot(fxCurveKey));`

I have no idea why it is doing this. I am passing the right parameters, inputting the correct address for the service, what else should I be checking here?

Btw, `WCFServiceChannelFactory` is our own class we use to take care of making service calls. Outline here:

```
public class WCFServiceChannelFactory<T> : IDisposable
    {
        public WCFServiceChannelFactory();
        public WCFServiceChannelFactory(Uri uri);

        public T Channel { get; }
        public System.ServiceModel.ChannelFactory<T> ChannelFactory { get; }
        public Type ChannelType { get; }

        public void Call(Action<T> f);
        public R Call<R>(Func<T, R> f);
        public void Dispose();
    }

```

The thing is, the problem is not with this, as this is working in the same exact fashion in every other project but this one. Basically, I have to pass the `Uri` directly in mine, where as others derive it from a .config file in the project, which I was unable to do here. That's the only difference.

Thanks.

Answer: 
I am using 4.0 and i have configured it like as follow:

```
<system.serviceModel>
    <bindings>
      <webHttpBinding>
        <binding name="defaultBasicHttpBinding">
          <security mode="Transport">
            <transport clientCredentialType="None" proxyCredentialType="None"/>
            <!--<message clientCredentialType="Certificate" algorithmSuite="Default" />-->
          </security>
        </binding>
      </webHttpBinding>
    </bindings>

    <client>
      <endpoint address="https://abc1234.abc.nsroot.net/MyService/MyService.svc"
                binding="webHttpBinding"
                bindingConfiguration="defaultBasicHttpBinding"
                contract="IMyService"
                name="TestJeph"/>
    </client>
  </system.serviceModel>

```

**FYI: I am calling the WCF Rest service, does it matter?**

the following is my service interface that i have created in the web app solution:

```
namespace anothertest
{
    using System;
    using System.ServiceModel;

    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ServiceModel.ServiceContractAttribute(ConfigurationName = "IMyService")]
    public interface IMyService
    {

        [OperationContract]
        test.WebService.Entity.BusinessEntity[] GetAllActiveBusiness();
    }

 public class ProductClient : ClientBase<IMyService>, IMyService
        {
            #region Members

            public test.WebService.Entity.BusinessEntity[] GetAllActiveBusiness()
            {
                return Channel.GetAllActiveBusiness();
            }

            #endregion
        }
}

```

the following is the code to call the service:

```
anothertest.Utility.ServiceHelper.UsingContract<anothertest.IMyService>
            ("TestJeph",
            svc=>
            {
                string test = svc.UpdateCMPStatus("test", "me");
            }); 

```
Are you targeting .Net 3.5 or .Net 4.0 ? In .Net 4.0 you get lots of defaults for the configuration of the service. In .Net 3.5 you are going to have to configure the endpoint completely in either in the App.config or programatically. For example what binding is the enpoint using ? If you are using .Net 4.0 then you are going to get a BasicHttpBinding by default since you specified an http uri. In .Net 3.5 you are going to fault as there will be no binding configured.