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.


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…


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 =…


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…


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…


How to see windows using remote desktop with dual monitors

Let us say i want to connect my laptop to my office machine, which uses dual monitors. I can see some of the windows icons showing up in the taskbar, but i cannot see the window. How can I click any button on that window? Here is the solution: Right click on the window you want on the taskbar, select move, hit…


A possible solution to a common sql error

If you happen to get the following sql error:    An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005 or above, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections..   You are not alone. There are…


How to make a 24” monitor look better

1920 X 1200 is the resolution you wanted for the 24″ monitor. The old 1600 X 1200 would make everything looks flattened. So what if my highest resolution is 1600 X 1200? The solution is that you need to update your new driver. Here is how you can do it on Vista.  Right click on…


WCF error: Cannot resolve KeyInfo for unwrapping key: KeyInfo ‘SecurityKeyIdentifier

If you are getting an error like : Cannot resolve KeyInfo for unwrapping key: KeyInfo ‘SecurityKeyIdentifier and your have checked that your certificate is in the right store and right place. So this might be the reason. check the binding you have and make sure the negotiateServiceCredential has the same value. By default, it is…


Going to Tech Ed China 2007

I am going to attend Tech Ed China 2007 again. I am very excited about it.