Timeouts WCF Services

Client side: SendTimeout is used to initialize the OperationTimeout, which governs the whole interaction for sending a message (including receiving a reply message in a request-reply case). This timeout also applies when sending reply messages from a CallbackContract method. OpenTimeout and CloseTimeout are used when opening and closing channels (when no explicit timeout value is … Read more

BasicHttpBinding vs WsHttpBinding vs WebHttpBinding

You’re comparing apples to oranges here: webHttpBinding is the REST-style binding, where you basically just hit a URL and get back a truckload of XML or JSON from the web service basicHttpBinding and wsHttpBinding are two SOAP-based bindings which is quite different from REST. SOAP has the advantage of having WSDL and XSD to describe … Read more

Maximum array length quota

My Bad – I forgot to apply my binding configuration to my endpoint in my server-side config. The server config should read: <system.serviceModel> <bindings> <netTcpBinding> <binding name=”NetTcpBinding_ImageResizerServiceContract” closeTimeout=”00:01:00″ openTimeout=”00:01:00″ receiveTimeout=”00:10:00″ sendTimeout=”00:01:00″ transactionFlow=”false” transferMode=”Buffered” transactionProtocol=”OleTransactions” hostNameComparisonMode=”StrongWildcard” listenBacklog=”10″ maxBufferPoolSize=”2147483647″ maxBufferSize=”2147483647″ maxConnections=”10″ maxReceivedMessageSize=”2147483647″> <readerQuotas maxDepth=”2147483647″ maxStringContentLength=”2147483647″ maxArrayLength=”2147483647″ maxBytesPerRead=”2147483647″ maxNameTableCharCount=”2147483647″ /> <reliableSession ordered=”true” inactivityTimeout=”00:10:00″ enabled=”false” /> <security mode=”Transport”> <transport … Read more

Performance Tests of Serializations used by WCF Bindings

OK; I’ll bite… here’s some raw serializer metrics (emph: you may need to consider base-64/MTOM to get overall bandwidth requirements, plus whatever fixed overheads (both space and CPU) that WCF adds), however; results first: BinaryFormatter Length: 1314 Serialize: 6746 Deserialize: 6268 XmlSerializer Length: 1049 Serialize: 3282 Deserialize: 5132 DataContractSerializer Length: 911 Serialize: 1411 Deserialize: 4380 … Read more

How to programmatically connect a client to a WCF service?

You’ll have to use the ChannelFactory class. Here’s an example: var myBinding = new BasicHttpBinding(); var myEndpoint = new EndpointAddress(“http://localhost/myservice”); using (var myChannelFactory = new ChannelFactory<IMyService>(myBinding, myEndpoint)) { IMyService client = null; try { client = myChannelFactory.CreateChannel(); client.MyServiceOperation(); ((ICommunicationObject)client).Close(); myChannelFactory.Close(); } catch { (client as ICommunicationObject)?.Abort(); } } Related resources: How to: Use the ChannelFactory