0

在我的程序中,我试图将图像保存到数据库。我遇到了一个例外

协议异常未处理”远程服务器返回意外响应(400)错误请求

我查了一下谷歌,发现在app.config. 我试过了,但即使这样也没有用。这是我的app.config

 <?xml version="1.0" encoding="utf-8" ?>
 <configuration>
     <system.serviceModel>
        <bindings>
         <basicHttpBinding>
           <binding name="BasicHttpBinding_IService1" closeTimeout="00:01:00"
              openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
              allowCookies="false" bypassProxyOnLocal="false"  
              hostNameComparisonMode="StrongWildcard"
              maxBufferSize="524288" maxBufferPoolSize="524288" maxReceivedMessageSize="524288"
              messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
           useDefaultWebProxy="true">
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
               maxBytesPerRead="4096" maxNameTableCharCount="16384" />
         <security mode="None">
         <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
         <message clientCredentialType="UserName" algorithmSuite="Default" />
       </security>
      </binding>
    </basicHttpBinding>
    </bindings>
    <client>
       <endpoint address="http://localhost:55750/Service1.svc" binding="basicHttpBinding"
           bindingConfiguration="BasicHttpBinding_IService1" contract="PeerService.IService1"
          name="BasicHttpBinding_IService1" />
      </client>
     </system.serviceModel>
  </configuration>

你能告诉我如何解决吗?我真的陷入了这个问题......

4

1 回答 1

1

尝试提高所有值:

<!-- Used by basic WCF Services -->
<binding maxBufferPoolSize="20000000" maxBufferSize="20000000" maxReceivedMessageSize="20000000">
    <readerQuotas maxDepth="32" maxStringContentLength="20000000" maxArrayLength="20000000" maxBytesPerRead="20000000" maxNameTableCharCount="20000000"/>
</binding>
于 2013-04-09T16:53:47.737 回答