【问题标题】:The remote server returned an unexpected response: (413) Request Entity Too Large (service config vs client config)远程服务器返回意外响应:(413) Request Entity Too Large (service config vs client config)
【发布时间】:2014-01-08 22:54:11
【问题描述】:

已经有很多帖子了,但我无法让它发挥作用。这些帖子建议定义标签端点并绑定客户端和服务器端。我所拥有的只是应用程序 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 出现了同样的错误。您可以在哪里解决问题?

标签: asp.net file-upload web-config app-config endpoint


【解决方案1】:

我在使用 xamlx(Windows Workflow Foundation Web Services)时遇到了同样的问题,我尝试了一堆 WCF 解决方案都没有成功,但我在 asp.net 论坛上找到了以下解决方案;即使在 IIS Express 上也能完美运行。

参考:Problem with XAMLX service in .Net 4.0

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-23
    • 1970-01-01
    • 2012-10-05
    • 1970-01-01
    相关资源
    最近更新 更多