silverlight-4.0 – 自定义WCF RIA服务端点

是否可以自定义WCF RIA Services端点的参数?具体来说,我想为端点创建自定义绑定,并增加maxReceivedMessageSize以允许发送大小为几兆字节的文件内容.

我已经尝试插入web.config,但是我收到以下错误

[InvalidOperationException]: The
contract name MyNamespace.MyService
Could not be found in the list of
contracts implemented by the service
MyNamespace.MyService

web.config

<system.serviceModel>
  <bindings>
    <customBinding>
      <binding name="CustomBinaryHttpBinding">
        <binaryMessageEncoding />
        <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
      </binding>
    </customBinding>
  </bindings>
  <services>
    <service name="MyNamespace.MyService">
      <endpoint address="" binding="wsHttpBinding" contract="MyNamespace.MyService" />
      <endpoint address="/binary" binding="customBinding" bindingConfiguration="CustomBinaryHttpBinding" contract="MyNamespace.MyService" />
    </service>
  </services>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>

解决方法

我们遇到了类似的问题 – 我们希望使用WCF-RIA服务调用操作将Silverlight客户端的大位图发送到服务器.

Web.config中的以下更改为我们工作:

<httpRuntime requestValidationMode="2.0" maxRequestLength="6225920"/>

How to configure Parameter/Message length for WCF-RIA-Service operation

相关文章

如何在Silverlight4(XAML)中绑定IsEnabled属性?我试过简单的...
我正在编写我的第一个vb.net应用程序(但我也会在这里标记c#,...
ProcessFile()是在UIThread上运行还是在单独的线程上运行.如...
我从同行那里听说,对sharepoint的了解对职业生涯有益.我们不...
我正在尝试保存一个类我的类对象的集合.我收到一个错误说明:...
我需要根据Silverlight中的某些配置值设置给定控件的Style.我...