WCF service hangs when calling method, however method is working

256 views Asked by At

Hello I'm having issue with my wcf service. I'm trying to call method which returns list of type object. I'm also using entity framework.

public IList<Product> GetAllProducts()
    {
        using (var db = new AuctionContext())
        {
            return db.Products.ToList();
        }
    }

    </service>
  <service name="AuctionSystem.WcfService.ProductService">
    <endpoint address="" binding="wsDualHttpBinding" contract="AuctionSystem.WcfService.Contracts.IProductService">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:9993/Design_Time_Addresses/AuctionSystem.WcfService/ProductService/" />
      </baseAddresses>
    </host>
  </service>

And contract :

 [OperationContract]
    IList<Product> GetAllProducts();

The method itself is working, but when I try to invoke this method on my wcf service UI it got stuck at "invoking service" I'm using wsdualhttpbinding.

Any ideas please?

EDIT: I realized in Product object I have virtual List, why is this List causing wcf to hang?

1

There are 1 answers

0
Lukáš Václavek On BEST ANSWER

For all wondering why It was caused because of circular dependency.