this is if my first attempt to use streaming for WCF and I am struggling with the terrible "The remote server responded with an unexpected response: (400)" Bad request ".
The trace viewer says this is a System.ServiceModel.ProtocolException message with the message "There is a problem with the XML that was received from the network. See the internal exception for details." The internal exception type says: "The body of the message cannot be read because it is empty."
Leaving everything else equal, if I switch to client-side buffered mode, I can debug the server code!
For some reason, I have to programmatically configure my service as follows:
public IUniverseFileService OpenProxy(string serviceUrl) { Debug.Assert(!string.IsNullOrEmpty(serviceUrl)); var binding = new BasicHttpBinding(); binding.Name = "basicHttpStream"; binding.MaxReceivedMessageSize = 1000000; binding.TransferMode = TransferMode.Streamed; var channelFactory = new ChannelFactory<localhost.IUniverseFileService>( binding, new EndpointAddress(serviceUrl)); return channelFactory.CreateChannel(); }
So far, the server is configured as follows:
<system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="serviceBehavior"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="true" httpHelpPageEnabled="true"/> <dataContractSerializer maxItemsInObjectGraph="2147483647"/> </behavior> </serviceBehaviors> </behaviors> <services> <service behaviorConfiguration="serviceBehavior" name="Org.Acme.UniverseFileService"> <endpoint address="" binding="basicHttpBinding" name="basicHttpStream" bindingConfiguration="httpLargeMessageStream" contract="Org.Acme.RemoteCommand.Service.IUniverseFileService" /> <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="" name="mexStream" contract="IMetadataExchange"/> </service> </services> <bindings> <basicHttpBinding> <binding name="httpLargeMessageStream" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" transferMode="Streamed"/> </basicHttpBinding> </bindings>
I appreciate your help!
Stefano
c # soap wcf streaming
Stefano ricciardi
source share