System.ServiceModel.Web is missing in Visual Studio 2010 Console Application


I was creating a managed host application for WCF Service. Although it was just to write few lines of codes in console application, it took 1 hrs for me to figure out a strange problem.

I followed steps as below,

  1. Created a console application
  2. I had to add reference of System.ServiceModel and System.ServiceModel.Web

And to my surprise System.ServiceModel.Web reference was missing,

Console1.gif

When I started looking for a solution on missing System.ServiceModel.Web, I found it was designed not have it in console application. Because by default, Console Application targets to .Net Framework 4 client profile and client profile does not have System.ServiceModel.Web dll

Console2.gif

So if you want to add System.ServiceModel.Web in console application, essentially you will have to change Target Framewrok of the console application.

To change target framework, right click and select Properties. On the Application tab you will get option to change

Console3.gif

After changing target framework you will get System.ServiceModel.Web to add as reference in your console application project.

Console4.gif

Up Next
    Ebook Download
    View all
    Learn
    View all