Wcf 远程服务器返回错误:(413)请求实体太大

Wcf 远程服务器返回错误:(413)请求实体太大,wcf,Wcf,我知道这是一个多余的问题,我在上传一个超过100KB的文件时出错了 远程服务器返回错误:(413)请求实体太大 我正在将内容发布到WCF服务(64位环境)。我知道这应该通过管理maxReceivedMessageSize和相关行为来解决,但不幸的是,事实并非如此 以下是我的配置:- 客户端 <binding allowCookies="false" bypassProxyOnLocal="false" closeTimeout="00:01:00" hostNameCompari

我知道这是一个多余的问题,我在上传一个超过100KB的文件时出错了

远程服务器返回错误:(413)请求实体太大

我正在将内容发布到WCF服务(64位环境)。我知道这应该通过管理maxReceivedMessageSize和相关行为来解决,但不幸的是,事实并非如此

以下是我的配置:-

客户端

     <binding allowCookies="false" bypassProxyOnLocal="false" closeTimeout="00:01:00" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" name="BasicHttpBinding_ICandidateManagementService" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:11:00" textEncoding="utf-8" transferMode="Streamed" useDefaultWebProxy="true">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
           maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None">
          <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
            <message algorithmSuite="Default" clientCredentialType="UserName"/>
          </security>
        </binding>

 <behavior name="CandidateBehavior">
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>

<endpoint address="http://localhost:62368/CandidateManagementService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICandidateManagementService" contract="MMJ.ServiceContracts.ServiceContract.ICandidateManagementService" name="BasicHttpBinding_ICandidateManagementService" behaviorConfiguration="CandidateBehavior" />

服务

<services>
      <service name="BasicHttpBinding_ICandidateManagementService" behaviorConfiguration="CandidateBehavior">
        <endpoint contract="MMJ.ServiceContracts.ServiceContract.ICandidateManagementService" binding="basicHttpBinding" address="" bindingConfiguration="BasicHttpBinding_ICandidateManagementService"/>
      </service>

我可能已经看到了所有可用的东西,但仍然无法解决这个问题。也尝试过使用下面的配置,但仍然没有更改

<serverRuntime uploadReadAheadSize="500000000" maxRequestEntityAllowed="500000000"/>

请帮忙

服务绑定配置(与客户端相同)



下面是小提琴手们的发现,让我们有更多的了解:-

请求计数:发送1字节:85719(头:697;正文:85022) 接收字节数:10129(标题:254;正文:9875)


您正在将数据发布到服务器,因此更新客户端设置没有帮助。客户端不是接收大消息的那个,服务器是

您正在将数据发布到服务器,因此更新客户端设置没有帮助。客户端不是接收大消息的那个,服务器是

查看您的客户端端点:

bindingConfiguration不应该是吗

bindingConfiguration="BasicHttpBinding_ICandidateManagementService"
而不是

bindingConfiguration="BasicHttpBinding_IAdminService"

查看您的客户端端点:

bindingConfiguration不应该是吗

bindingConfiguration="BasicHttpBinding_ICandidateManagementService"
而不是

bindingConfiguration="BasicHttpBinding_IAdminService"

经过努力,我的问题终于解决了我的服务配置中有一个缺陷,它没有给我任何运行时或编译时错误,因为它甚至无法识别配置

我的服务配置是:-

<services>
      <service name="BasicHttpBinding_ICandidateManagementService" behaviorConfiguration="CandidateBehavior">
        <endpoint contract="MMJ.ServiceContracts.ServiceContract.ICandidateManagementService" binding="basicHttpBinding" address="" bindingConfiguration="BasicHttpBinding_ICandidateManagementService"/>
      </service>

我有一个“Name”属性,它不是我服务的完全限定名,因此我使用的配置甚至没有被考虑,因此maxReceivedMessageSize的默认值为65KB

我已经更新了它,它的工作就像一个魅力

<services>
  <service name="MMJ.Services.CandidateManagementService">
    <endpoint contract="MMJ.ServiceContracts.ServiceContract.ICandidateManagementService" binding="basicHttpBinding" address="" bindingConfiguration="BasicHttpBinding_ICandidateManagementService"/>
  </service>


另外,请查看此文档以获取更多参考。我知道这是一个愚蠢的错误,并感谢大家努力解决。

经过多次努力,我的问题终于解决了我的服务配置中有一个缺陷,它没有给我任何运行时或编译时错误,因为它甚至无法识别配置

我的服务配置是:-

<services>
      <service name="BasicHttpBinding_ICandidateManagementService" behaviorConfiguration="CandidateBehavior">
        <endpoint contract="MMJ.ServiceContracts.ServiceContract.ICandidateManagementService" binding="basicHttpBinding" address="" bindingConfiguration="BasicHttpBinding_ICandidateManagementService"/>
      </service>

我有一个“Name”属性,它不是我服务的完全限定名,因此我使用的配置甚至没有被考虑,因此maxReceivedMessageSize的默认值为65KB

我已经更新了它,它的工作就像一个魅力

<services>
  <service name="MMJ.Services.CandidateManagementService">
    <endpoint contract="MMJ.ServiceContracts.ServiceContract.ICandidateManagementService" binding="basicHttpBinding" address="" bindingConfiguration="BasicHttpBinding_ICandidateManagementService"/>
  </service>



另外,请查看此文档以获取更多参考。我知道这是一个愚蠢的错误,感谢大家努力修复。

我认为您还需要在IIS中设置一些内容,但不确定。我不这样认为,如果您遇到任何问题,请告诉我。我在Chrome上检索到了相同的错误。当我切换到Firefox时,所有问题都消失了。我以为你也需要在IIS中设置一些东西,但不确定。我不这样认为,如果你遇到任何问题,请告诉我。我在Chrome上检索到了相同的错误。当我切换到Firefox时,所有问题都消失了。我同意。。。我已经更新了服务器配置。它仍然没有产生任何结果。你能发布配置的“BasicHttpBinding_IcandDateManagementService”部分吗?谢谢你的帮助。。。我最终解决了这个问题。我同意。。。我已经更新了服务器配置。它仍然没有产生任何结果。你能发布配置的“BasicHttpBinding_IcandDateManagementService”部分吗?谢谢你的帮助。。。我最终解决了这个问题。这只是问题中的一个输入错误,我使用了正确的配置。您的传输模式是流式传输还是缓冲(您的参数/响应流类型)?根据您的配置,您在服务上执行缓冲,但在客户端执行流式处理。我认为它们的两端都必须是相同的,否则它怎么知道如何相应地将其分块?你有没有/你能试着把它们做得一样,再给它一次机会看看是否有效?我检查过了,我在服务器和客户端都使用了缓冲区。由于我的实现中没有流的概念。这只是问题中的一个输入错误,我使用的是正确的配置。传输模式(参数/响应流类型)是流还是缓冲?根据您的配置,您在服务上执行缓冲,但在客户端执行流式处理。我认为它们的两端都必须是相同的,否则它怎么知道如何相应地将其分块?你有没有/你能试着把它们做得一样,再给它一次机会看看是否有效?我检查过了,我在服务器和客户端都使用了缓冲区。因为我的实现中没有流媒体的概念。你的问题对我很有帮助。我也有同样的问题,但仅使用
maxReceivedMessageSize=“2000000”
就解决了。您的问题对我很有帮助。我遇到了同样的问题,但仅使用
maxReceivedMessageSize=“2000000”
就解决了。