2

当对象很小时,我有这个例外

更新条目时出错。有关详细信息,请参阅内部异常

当对象很大时,我有这个例外

远程服务器返回意外响应:(400) Bad Request

客户端:app.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IService11" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
                    maxReceivedMessageSize="2147483647" messageEncoding="Text"
                    textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
                    <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://localhost:10965/Service1.svc" binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_IService11" contract="ServiceReference2.IService1"
                name="BasicHttpBinding_IService11" />
        </client>
    </system.serviceModel>
</configuration>

WCF:web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
      <httpRuntime maxRequestLength="2147483647" />
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>
    </compilation>
  </system.web>

  <system.serviceModel>
      <bindings>
          <basicHttpBinding>
              <binding name="customBinding" hostNameComparisonMode="StrongWildcard" receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:10:00" closeTimeout="00:10:00"
                     maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" transferMode="Buffered"
                     messageEncoding="Text" textEncoding="utf-8" bypassProxyOnLocal="true" useDefaultWebProxy="true" >
                  <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxStringContentLength="2147483647" maxNameTableCharCount="2147483647"/>
              </binding>
          </basicHttpBinding>
      </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true" />

        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>
  <connectionStrings><add name="SASPEEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.;Initial Catalog=SASPE;Integrated Security=True;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" /><add name="SASPEEntities1" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.;Initial Catalog=SASPE;Integrated Security=True;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" /><add name="SASPEEntities2" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.;initial catalog=SASPE;integrated security=True;pooling=False;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>


</configuration>

和 wcf:web.debug.config

<?xml version="1.0"?>

<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">

    <system.serviceModel>
        <services>
            <service name="WcfService1.Service1">
                <endpoint address="http://localhost:10965/Service1.svc?wsdl"
                    binding="basicHttpBinding"  bindingConfiguration="customBinding" contract="WcfService1.IService1"  />
            </service>
        </services>
    </system.serviceModel>
</configuration>
4

1 回答 1

0

错误“更新条目时发生错误。有关详细信息,请参阅内部异常”当我遇到实体框架与我的数据库通信的问题(列不匹配或溢出等)时,我经常看到如果您执行以下代码您的 WCF 公开类正在通过 WCF 调用,您应该能够查看内部异常并找出 EF 不喜欢您的数据库的哪些方面。

传递大数据时的 400 错误请求看起来很像这里描述的问题-Large

WCF web service request failed with (400) HTTP Bad Request

于 2012-11-21T10:50:40.457 回答