Customize a WCF RIA Services Endpoint
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 co开发者_StackOverflow中文版uld 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>
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:
<httpRuntime requestValidationMode="2.0" maxRequestLength="6225920"/>
See How to configure Parameter/Message length for WCF-RIA-Service operation
精彩评论