微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐