【问题标题】:WCF service hangs when calling method, however method is working调用方法时 WCF 服务挂起,但方法正在运行
【发布时间】:2017-11-30 23:10:12
【问题描述】:

您好,我的 wcf 服务有问题。我正在尝试调用返回类型对象列表的方法。我也在使用实体框架。

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>

和合同:

 [OperationContract]
    IList<Product> GetAllProducts();

该方法本身正在工作,但是当我尝试在我的 wcf 服务 UI 上调用此方法时,它卡在“调用服务”中,我正在使用 wsdualhttpbinding。

有什么想法吗?

编辑:我在 Product 对象中意识到我有虚拟列表,为什么这个列表会导致 wcf 挂起?

【问题讨论】:

    标签: sql linq wcf wsdualhttpbinding


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-29
      相关资源
      最近更新 更多