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,

clip_image001

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

clip_image003

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

clip_image005

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

clip_image007

6 responses to “System.ServiceModel.Web is missing in Visual Studio 2010 Console Application ?”

  1. […] System.ServiceModel.Web is missing in Visual Studio 2010 Console Application ? (Dhananjay Kumar) […]

  2. Hello,
    I created claim aware WCF service and added STS (ADFS2.0) reference to it. Also added WCF service url as trusted relying party in ADFS.
    I am able to browse the WCF service from IIS without issue and its service reference URL is displayed appropriately.
    When I add service reference in a console client application and try receiving message sent by service I receive an exception as below

    System.ServiceModel.Security.MessageSecurityException: An unsecured or incorrectly secured fault was received from the other party . See the inner FaultException for the fault code and detail. —> System.ServiceModel.FaultException: ID3242: The security token could not be authenticated or authorized

    I have tried a lot to resolve the issue but not able to fix this.

    Kindly let me know If any one has experience working on any application of this nature which will help me resolve the issue.

  3. Thanks for saving my time! I was struck – Ruble

  4. thank you sir!

  5. Thanks bro, you rocked 🙂

Leave a comment

Create a website or blog at WordPress.com