我已经在网上挖了两天关于它,我不能让我的asp.net网站上传大于16Kb的文件 我正在使用fileUploader,wcf,我在客户端有服务引用。 当我上传30KB大小的文件时,它要求我增加MaxArrayLength。
读取XML数据时已超出最大数组长度配额(16384)。可以通过更改此配额来增加此配额 2 创建XML阅读器时使用的XmlDictionaryReaderQuotas对象上的MaxArrayLength属性。第1行,第205847号。
这就是我所做的,但它一直在抱怨这个。
如果我上传1MB大小的文件,我会收到400错误。
远程服务器返回错误:(400)错误请求
请帮助
客户端app.config:
<bindings>
<basicHttpBinding>
<binding name="streamingBinding"
transferMode="Streamed"/>
<binding name="BasicHttpBinding_IBLServer" 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="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8888/BLService.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IBLServer" contract="WSRef.IBLServer"
name="BasicHttpBinding_IBLServer" />
</client>
WCF web.config:
<system.serviceModel>
<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="false"/>
</behavior>
<behavior name="BLServer.BackEndBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceTimeouts transactionTimeout="05:05:00" />
<serviceThrottling maxConcurrentCalls="500" maxConcurrentSessions="500"
maxConcurrentInstances="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="streamingBinding"
transferMode="Streamed"/>
<binding name="BasicHttpBinding_IBLServer"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
<readerQuotas
maxDepth="64"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="4096"
maxNameTableCharCount="16384"/>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="BLServer.BackEndBehavior" name="WSRef.BackEnd">
<endpoint address="" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IBLServer"
contract="WSRef.IBLServer" />
</service>
<service name="StreamingService.Upload">
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="streamingBinding"
contract="StreamingService.IUpload"/>
</service>
</services>
文件&lt; 16 KB已成功上传。
你可以找出我做错了吗?答案 0 :(得分:1)
检查这些:
WCF service The maximum array length quota (16384) has been exceeded
How to handle large file uploads via WCF?
希望这有帮助。
答案 1 :(得分:0)
我几个小时都在努力解决同样的问题。最后,我意识到我正在使用配置文件转换,我的maxArrayLength
一直被转换覆盖。一些咖啡因的时间。