System.ServiceModel.Web missing from .NET references

I ran into this issue more than twice already, so I figured I’d help Google be more effective in solving it for others..

One of the cool things about WCF is that it is fairly straight forward to configure communication with non .NET enabled technologies (i.e. Java, JavaScript, etc) via JSON or just plain SOAP. I am considering writing my own how-to on getting this to work, particularly from JavaScript and Android applications, but that is a topic for another post.

However, I will mention that one of the stipulations for getting this to work is decorating the OperationContract interface members with additional attributes, namely WebInvoke or WebGet.

These attributes are members of the System.ServiceModel.Web namespace and you need to add a reference the System.ServiceModel.Web .Net component in your application.

The thing that repeatedly happens to me is that when I go to add the reference, System.ServiceModel.Web is missing form the list. I then scratch my head and contemplate whether or not it is a deja vu experience (and it is).

The issue is quite simple – System.ServiceModel.Web is not part of the ‘.NET Framework 4 Client‘ Profile, which is the default profile Visual Studio creates for a WCF library project. It is however, part of the plain old ‘.NET Framework 4’ Profile.

The solution is to change the Target Framework in your project’s Application Properties (in Project Properties). Do that and voila! System.ServiceModel.Web is now available for your referencing pleasure.

Sorry for the excessive French jargon in the post.