簡體   English   中英

遠程服務器返回了意外的響應:(413)請求實體太大(服務配置與客戶端配置)

[英]The remote server returned an unexpected response: (413) Request Entity Too Large (service config vs client config)

已經有很多帖子了,但是我無法使它正常工作。 這些帖子建議定義標簽端點並綁定客戶端和服務器端。 我所擁有的只是應用程序的web.config文件。 如何區分客戶端和服務器端。 在我的web.config中,我定義了一個服務標簽,但似乎沒有使用它,因為在調試時從未調出其中定義的面部綁定配置。 我的web.config看起來像這樣:

<?xml version="1.0"?>

<configuration>
  <configSections>
     <sectionGroup name="****" type="****, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=*********" >
       <section name="********" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=*********" requirePermission="false" />
     </sectionGroup>
  </configSections>
  <system.serviceModel>
    <bindings>
       <basicHttpBinding>
           <binding name="binding1_IService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" messageEncoding="Text">
               <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
               <security mode="None">
                    <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
                    <message clientCredentialType="UserName" algorithmSuite="Default" />
               </security>
            </binding>
            <binding name="binding2_IService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" messageEncoding="Text">
                <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                <security mode="None">
                     <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
                     <message clientCredentialType="UserName" algorithmSuite="Default" />
                </security>
            </binding>
       </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http:aaa.com/bbb.xamlx" binding="basicHttpBinding" bindingConfiguration="binding1_IService" contract="App.IAppService"  />
        <endpoint address="http:aaa.com/bbb.xamlx" binding="basicHttpBinding" bindingConfiguration="binding2_IService" contract="App2.IApp2Service"  />
    </client>
    <behaviors>
        <serviceBehaviors>
            <behavior>
                <serviceMetadata httpGetEnabled="true"/>
                <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>

   <!--Not sure this is where to put this and if it is correct -->
   <services>
     <service  name="namespace.classname">
        <endpoint  address="http:aaa.com/bbb.xamlx" binding="basicHttpBinding" contract="App.IAppService" bindingConfiguration="binding1.IService" />
        <endpoint address="http:aaa.com/bbb.xamlx" binding="basicHttpBinding" contract="App.IAppService2" bindingConfiguration="binding2.IService" />
      </service>
  </services>
  <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.web>
     <customErrors mode="Off" />
     <compilation debug="true" targetFramework="4.0" />
     <authentication mode="Windows" />
     <authorization>
         <deny users="?"/>
     </authorization>
  </system.web>
 <system.webServer>
      <modules runAllManagedModulesForAllRequests="true"/>
 </system.webServer>
 <connectionStrings>
 <add name="name" connectionString="string" providerName="System.Data.EntityClient" />
 </connectionStrings>
</configuration>

上載非文本文件時,我不斷收到上述錯誤。 任何幫助請...

我在xamlx(Windows Workflow Foundation Web服務)上遇到了同樣的問題,並且嘗試了很多WCF解決方案,但均未成功,但是我在asp.net論壇上找到了以下解決方案。 即使在IIS Express上也可以完美運行。

參考: .Net 4.0中的XAMLX服務問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM