5/30/11

LINQ to SQL with NOLOCK

If your project uses LINQ to SQL for your database access, you may want to use NOLOCK to set the isolation level to ReadUncommitted on your select statements. This prevents the database engine from issuing locks on the tables that we are trying to select data from which helps increase concurrency and performance. The area of concern is that LINQ does not understand query hints. The way...

5/25/11

The HTTP request is unauthorized with client authentication scheme 'Basic'

There are several examples on the internet that focus on implementing a custom username password validator for a WCF service. Most of those samples are written using self-hosted applications and work as designed. There is a problem however when the same approach needs to be implemented using an IIS hosted site with Basic authentication enabled. If you have implemented a custom user name password...

5/19/11

WCF Service operations can’t be loaded due to mixing of message contract types and primitive types

When debugging your WCF Service, you may encounter the following error:“The operation could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with MessageContractAttribute, the method must not use any other...

5/14/11

WCF Service Project Properties is missing the WCF Options Tab

If your WCF Library project does not auto start the WCF Service host when trying to start the project in debug mode, the project file has some missing elements. A way to check this is to right click on the project name (Visual Studio) and look for the WCF Options tabs on the left side of the window.  If you do not see the tab, this means that the library project for some reason was not created...

4/25/11

WebClient Class with Cookies

The WebClient class can be used to automate the login to a web application. If the web application requires the client to enable cookies which is often the case when the application uses session state, the application returns an error to the client indicating that cookies must be enabled. The WebClient class can be extended to support cookies by overriding the GetWebRequest method and implementing...