【问题标题】:WCF REST services 'unexpected end of file'WCF REST 服务“文件意外结束”
【发布时间】:2011-10-09 23:55:51
【问题描述】:

我有一个 ASP.NET Web 应用程序,我在其中使用 WCF REST 服务插入 500 条记录,但收到错误“文件意外结尾”我放了

<bindings>
  <basicHttpBinding>
    <!-- Create a custom binding for our service to enable sending large amount of data -->
    <binding name="NewBinding0" sendTimeout="00:10:00" maxBufferPoolSize="2147483647"  maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"   maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>

  </basicHttpBinding>

</bindings>

在客户端配置和服务配置中,但存在相同的问题...任何解决方案

【问题讨论】:

    标签: wcf wcf-rest


    【解决方案1】:

    解决方案可能是停止并搜索一些有关 WCF 和 REST 的文章,并至少了解您尝试使用的 API 的基本知识。

    basicHttpBinding 用于 SOAP 服务,而不用于 REST 服务。 REST 服务使用webHttpBinding,因此很难说您的应用程序中发生了什么,因为您的第一条语句

    我正在使用 WCF REST 服务

    与您的其他问题直接冲突。

    【讨论】:

      【解决方案2】:

      Mrnka 是正确的,您应该将 webHttpBinding 用于 REST。你的 web.config 文件应该有这个:

          <system.serviceModel>
          <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
            <bindings>
              <webHttpBinding>
                <binding>
                  //binding here
                </binding>
              </webHttpBinding>
            </bindings>
      
          <standardEndpoints>
              <webHttpEndpoint>
                  <!-- 
              Configure the WCF REST service base address and the default endpoint 
                   -->
          </system.serviceModel>
      

      【讨论】:

        猜你喜欢
        • 2023-03-23
        • 1970-01-01
        • 1970-01-01
        • 2016-12-11
        • 1970-01-01
        • 1970-01-01
        • 2018-08-18
        • 2012-06-10
        相关资源
        最近更新 更多