自定义 WCF RIA 服务端点
是否可以自定义 WCF RIA 服务端点的参数?具体来说,我想为端点创建自定义绑定并增加 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>
Is it possible to customize the parameters of a WCF RIA Services endpoint? Specifically, I would like to create a custom binding for the endpoint and increase the maxReceivedMessageSize
to allow sending the contents of a file that is a few megabytes in size.
I've tried meddling in the web.config, but I'm getting the following error:
[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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们遇到了类似的问题 - 我们希望使用 WCF-RIA 服务调用操作将大型位图从 Silverlight 客户端发送到服务器。
Web.config 中的以下更改对我们有用:
请参阅 如何为 WCF-RIA-Service 操作配置参数/消息长度
We had a similar problem - we want to send large bitmaps fom Silverlight client to Server using WCF-RIA service invoke operation.
The following change in Web.config worked for us:
See How to configure Parameter/Message length for WCF-RIA-Service operation