Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WCF REST服务“意外的文件结尾”_Wcf_Wcf Rest - Fatal编程技术网

WCF REST服务“意外的文件结尾”

WCF REST服务“意外的文件结尾”,wcf,wcf-rest,Wcf,Wcf Rest,我有一个ASP.NET web应用程序,我正在使用WCF REST服务插入500个REORD,但收到了我输入的错误“意外的文件结尾” <bindings> <basicHttpBinding> <!-- Create a custom binding for our service to enable sending large amount of data --> <binding name="NewBinding0" sendTi

我有一个ASP.NET web应用程序,我正在使用WCF REST服务插入500个REORD,但收到了我输入的错误“意外的文件结尾”

<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>

在客户端cofig和服务配置中,都存在相同的问题…此解决方案的任何解决方案都可能是停止并搜索一些有关WCF和REST的文章,至少了解您尝试使用的API的要点

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

我正在使用WCF REST服务


与您的问题的其余部分直接冲突。

解决方案可能是停止并搜索一些有关WCF和rest的文章,至少了解您尝试使用的API的要点

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

我正在使用WCF REST服务


与您的问题的其余部分直接冲突。

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>

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>