自定义WCF RIA服务端点

And*_*son 5 web-config silverlight-4.0 wcf-ria-services

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

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

[InvalidOperationException]:在服务MyNamespace.MyService实现的合同列表中找不到合同名称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>
Run Code Online (Sandbox Code Playgroud)

Gar*_*wen 0

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

Web.config 中的以下更改对我们有用:

<httpRuntime requestValidationMode="2.0" maxRequestLength="6225920"/>
Run Code Online (Sandbox Code Playgroud)

请参阅如何配置 WCF-RIA-Service 操作的参数/消息长度