Config based activation in WCF

There is a cool WCF feature instroduced in dev10 called configless activation. You don’t have to have a *.svc file in your web directory, instead you can activate a WCF service using the following configuration element:   <system.serviceModel>   <serviceHostingEnvironment>     <serviceActivations>      <add relativeAddress=“Service1.svc“ service=“configlessWCF.Service1“/>     </serviceActivations>   </serviceHostingEnvironment> </system.serviceModel> Hope this helps.

0

Why does the MaxReceiveMessageSize in WCF matter in case of Streaming

The default value of MaxReceiveMessageSize in WCF is 65,536.  When you choose streaming as TransferMode, WCF runtime will create 8192 as buffer size. So what happened now is that WCF channel stack will read the first 8192 bytes, and decode the first couple of bytes as the size of the entire envelope. Then we will do…

0

Timeouts in WCF and their default values

  There are a lot of timeouts in WCF. let us summarize it here. Timeouts on binding These are the most well known timeouts. SendTimeout, ReceiveTimeout, OpenTimeout and CloseTimeout. They can be set easily either through config or code on the Binding. The default value for those are 1 minute.  E.g in code Binding binding = new NetTcpBinding(SecurityMode.Transport) { SendTimeout =…

0

how to turn off the auto-redirect feature in WCF REST 4.0

Missing a trailing slash is a common error people make when browsing the web. For better usability, in 4.0, we introduced a feature called autoredirect. It is on by default, meaning, when you set up your REST service to take something like “test/”, when user types in http://hostname/ServiceName/test in the browser, they will be automatically…

0

How to solve System.InvalidOperationException: For request in operation Test to be a stream the operation must have a single parameter whose type is Stream

 You are getting this error because the default WCF stream formatter does not support this. You are probably trying to upload some file stream and transfer some other parameters, such as file name, etc within the same method. For example, [OperationContract]  void Test(string fileName, Stream fileContent); If this is not a REST endpoint, you can work around…

0