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
无法从客户端上载超过64kb的WCF REST服务_Wcf_Web Services_Wcf Rest - Fatal编程技术网

无法从客户端上载超过64kb的WCF REST服务

无法从客户端上载超过64kb的WCF REST服务,wcf,web-services,wcf-rest,Wcf,Web Services,Wcf Rest,我已经创建了一个WCF REST服务,并成功创建了一个将文件从客户端上传到该服务的函数 问题是,这仅在发送的文件小于等于64kb时有效。我怎样才能解决这个问题 web.config文件: <configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> <httpRuntime maxRequestLength="2147483647"/>

我已经创建了一个WCF REST服务,并成功创建了一个将文件从客户端上传到该服务的函数

问题是,这仅在发送的文件小于等于64kb时有效。我怎样才能解决这个问题

web.config文件:

<configuration>

<system.web>
    <compilation debug="true" targetFramework="4.0" />
    <httpRuntime maxRequestLength="2147483647"/>
</system.web>

<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxAllowedContentLength="100000000"> </requestLimits>
    </requestFiltering>
  </security>
  <validation validateIntegratedModeConfiguration="false"/>
    <modules runAllManagedModulesForAllRequests="true">
        <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </modules>
</system.webServer>

<system.serviceModel>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    <standardEndpoints>
        <webHttpEndpoint>
            <!-- 
        Configure the WCF REST service base address via the global.asax.cs file and the default endpoint 
        via the attributes on the <standardEndpoint> element below
    -->
            <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"/>
        </webHttpEndpoint>
    </standardEndpoints>
</system.serviceModel>

}

把它弄明白了。在谷歌搜索了3天后,我不得不将属性“maxReceivedMessageSize”和“maxBufferSize”添加到

,最后我找到了解决方案

在我的解决方案web.config中,我添加了https代码等。之后,我删除了所有配置并添加了以下代码



找到了答案。必须将属性“maxReceivedMessageSize”和“maxBufferSize”添加到您可以发布一个答案,然后在延迟后接受它(我认为需要一两天)。
namespace WCFRESTService
{
public class Global : System.Web.HttpApplication
{

    protected void Application_Start(object sender, EventArgs e)
    {
        RegisterRoutes();
    }

    private void RegisterRoutes()
    {
        // Edit the base address of Service1 by replacing the "Service1" string below
        RouteTable.Routes.Add(new ServiceRoute("RO", new WebServiceHostFactory(), typeof(Service1)));
    }
}