我知道此消息有太多重复,但请在这里给你点亮..
我从WCF Customer获得一个实体,其中包含base64中的照片字段。我在Android设备上获取它没有问题
当我更新时让我说这个客户的电话并在wcf上传实体我得到一个错误实体太大
请注意.. 如果我从解决方案调试我的WCF右键单击调试并尝试读取此实体我收到错误已超过传入邮件的最大邮件大小配额
奇怪的是我怎么可能在设备上读取实体但是我在调试时无法读取它而且我在保存时无法将其上传回来。
这里有三件不同的事情......
当我从代码连接到我的服务时,我就像这样做
ServiceEndPoint = New ServiceModel.EndpointAddress(New Uri("http://MyIpAddress:MyPort/WcfServiceLibrary1.Service1.svc"))
Dim Binding As New BasicHttpBinding
Binding.MaxReceivedMessageSize = 20000000
MyService = New ServiceReference1.Service1Client(Binding, ServiceEndPoint)
这是我的配置
<system.serviceModel>
<client>
<endpoint name="basicEndpoint"
address="http://localhost:8733/Design_Time_Addresses/WcfServiceLibrary1/Service1/"
binding="basicHttpBinding"
bindingConfiguration="basicHttp"
contract="WcfServiceLibrary1.IService1"
>
</endpoint>
</client>
<services>
<service name="WcfServiceLibrary1.Service1" behaviorConfiguration="ServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8452/Design_Time_Addresses/WcfServiceLibrary1/Service1/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="http://localhost:8542/Design_Time_Addresses/WcfServiceLibrary1/Service1/" binding="basicHttpBinding" bindingConfiguration="basicHttp" contract="WcfServiceLibrary1.IService1">
<!--Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.-->
<!--<identity>
<dns value="localhost" />
</identity>-->
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />-->
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="basicHttp" allowCookies="true" maxReceivedMessageSize="20000000" maxBufferSize="20000000" maxBufferPoolSize="20000000">
<readerQuotas maxDepth="32" maxStringContentLength="20000000" maxArrayLength="20000000" />
<security mode="None"></security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!-- To avoid disclosing metadata information,
set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" />
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<!-- 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>
答案 0 :(得分:1)
尝试将绑定中的所有属性值更改为2147483647。
尝试以编程方式设置值,如下所示 BasicHttpBinding binding = new BasicHttpBinding(){
MaxBufferSize = 2147483647,
MaxReceivedMessageSize = 2147483647
};