0

以下是我的 web.config 文件中的服务模型配置:

    <system.serviceModel>
  <behaviors>
    <serviceBehaviors>
      <behavior>
        <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
        <serviceMetadata httpGetEnabled="true" />
        <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
        <serviceDebug includeExceptionDetailInFaults="true" />
        <dataContractSerializer maxItemsInObjectGraph="2147483647" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <bindings>
    <basicHttpBinding>
      <binding name="BasicHttpBinding_IDataPortal" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00"
       allowCookies="false" bypassProxyOnLocal="true" hostNameComparisonMode="StrongWildcard"
       maxBufferPoolSize="524288" maxBufferSize="65536" maxReceivedMessageSize="65536"
       textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" messageEncoding="Text">
        <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096"
                      maxNameTableCharCount="2147483647"/>
        <security mode="None">
          <transport clientCredentialType="None" proxyCredentialType="None" realm=""></transport>
          <message clientCredentialType="UserName" algorithmSuite="Default"/>
        </security>
      </binding>
    </basicHttpBinding>
  </bindings>
  <client>
    <endpoint address="http://localhost:4481/MyDataService.svc"
              binding="basicHttpBinding"
              bindingConfiguration="BasicHttpBinding_IDataPortal"
              name="BasicHttpBinding_IDataPortal"
              contract="eBusiness_Core.Contracts.ServiceContracts.IBusinessData">
    </endpoint>
  </client>
  <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>

当我在 WCF 测试客户端中检查 WCF 方法的执行时,它会执行调用,但最后它会返回一个异常,提示“底层连接已关闭:连接已意外关闭”。我在 WCF 服务中使用了自定义类型,并使用“DataContract”和“Serializable”这两个属性来装饰它们。当我检查一个返回字符串的简单方法时,它工作正常。可能是什么原因?

4

1 回答 1

0

在升级 POCO 生成器类以使用 EF 5.0 后,这开始正常工作

于 2013-04-08T10:04:08.713 回答