我得到的大于64k消息maxreceivedmessagesize错误。 问题是,我已经在服务器和客户机改变了一切,它不是解决问题。
这里是我的服务器,然后Silverlight客户端配置上的web.config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="secureobjectbind" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="GiveWeb.Services.ShopBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="6553600" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="GiveWeb.Services.ShopBehavior"
name="GiveWeb.Services.Shop">
<endpoint address="" binding="basicHttpBinding"
bindingConfiguration="secureobjectbind"
contract="GiveWeb.Services.IShop">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding"
contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<clear/>
<add prefix="http://www.ushop2give.com"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
</system.serviceModel>
Silverlight客户端
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IShop" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://web14.ai-host.com/Services/Shop.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IShop"
contract="ShopSVC.IShop" name="BasicHttpBinding_IShop" />
</client>
</system.serviceModel>
</configuration>
所以为什么我仍然得到错误?
好吧,这里是为后somemore信息...
我发现了一个错误。 我原来的声明我结合目标物的System.ServiceModel.Channels.Binding不System.ServiceModel.BasicHttpBinding。 这就是为什么我没有看到物体上MaxReceivedMessageSize的属性。
我已经纠正了这一点,并创建了一个函数来创建我的代理,但是当超过65536个字节在返回消息我仍然收到错误消息。
public static ShopSVC.ShopClient ShopClientProxy()
{
System.ServiceModel.EndpointAddress lxAddress = new System.ServiceModel.EndpointAddress(new Uri(Application.Current.Host.Source, "../Services/Shop.svc"));
System.ServiceModel.BasicHttpBinding lxBinding = new System.ServiceModel.BasicHttpBinding(System.ServiceModel.BasicHttpSecurityMode.Transport);
lxBinding.MaxReceivedMessageSize = 2147483647;
lxBinding.MaxBufferSize = 2147483647;
lxBinding.ReceiveTimeout = new TimeSpan(0, 5, 0);
return new GiveSL.ShopSVC.ShopClient(lxBinding, lxAddress);
}