简体   繁体   English

WCF服务在调用方法时挂起,但是方法正在工作

[英]WCF service hangs when calling method, however method is working

Hello I'm having issue with my wcf service. 您好,我的wcf服务出现问题。 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. 该方法本身正在运行,但是当我尝试在wcf服务UI上调用此方法时,它卡在“调用服务”上,而我使用的是wsdualhttpbinding。

Any ideas please? 有什么想法吗?

EDIT: I realized in Product object I have virtual List, why is this List causing wcf to hang? 编辑:我意识到在Product对象中我有虚拟列表,为什么此列表导致wcf挂起?

所有人都想知道为什么是由于循环依赖引起的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM