0

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?

Lukáš Václavek
  • 442
  • 1
  • 6
  • 12

1 Answers1

0

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

Lukáš Václavek
  • 442
  • 1
  • 6
  • 12