我创建了一个简单的空asp.net网站并添加了wcf服务以将图像插入到数据库中。 我收到了最大数组配额的错误。我更改了我的客户端配置文件并提高了最大数组长度的限制。但仍然得到同样的错误。我也跟着这个Maximum array length quota,但我不太了解因为我是视觉工作室的新手。请帮我找错。
这是客户端的app.config文件。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client" />
</startup>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_Iupload" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="5242880" maxArrayLength="2147483646"
maxBytesPerRead="4096" maxNameTableCharCount="5242880" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:1028/WebSite8/upload.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Iupload"
contract="UploadRef.Iupload" name="BasicHttpBinding_Iupload" />
</client>
</system.serviceModel>
</configuration>
和网站的配置文件
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<add name="cst" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\Admin\My Documents\Visual Studio 2010\WebSites\WebSite8\App_Data\Hello.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" />
</connectionStrings>
<system.web>
<compilation debug="false" strict="false" explicit="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
</configuration>
答案 0 :(得分:0)
尝试在&#34; system.serviceModel&#34;之间添加这个。在网站的配置文件中。
<bindings>
<basicHttpBinding>
<binding maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxArrayLength="2147483647" maxDepth="2147483647" maxStringContentLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
</binding>
</basicHttpBinding>
</bindings>