49

I am developing a Windows service that exposes a WCF service intended to be consumed by a Silverlight application, as explained in this blog post: http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2008/03/27/10291.aspx

The problem I am facing is that I need to use the WebInvoke attribute, which is defined in the System.ServiceModel.Web.dll assembly, but when I try to add a reference to that assembly in the project (by using Visual Studio's Add Reference dialog - .NET tab), there is no assembly with that name.

So, am I doing something wrong, this assembly is not part of the standard .NET Framework, or it is a bug in Visual Studio? By the way I'm using VS2010 beta 2 and the project targets .NET Framework 4.

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
Konamiman
  • 49,681
  • 17
  • 108
  • 138

7 Answers7

98

Are you targetting .NET4 Full or Client Profile? The latter does not include the System.ServiceModel.Web assembly.

MattC
  • 3,984
  • 1
  • 33
  • 49
  • 1
    didn't help with mine, as my project is not targeting Client Profile but .NET Framework 4 (Full) :( – Muhammad Mamoor Khan Jan 01 '14 at 14:15
  • 1
    Changed nothing for me too. I've tried multiple frameworks, client profil or full, tried to run ServiceModelReg.exe to install eventual missing functionnalities. But I still can't use this dependency :( – Alex Oct 09 '14 at 11:58
  • This saved me! I am developing a service oriented application. It has multiple layers and one of its layer was a WCF class library and it was targetting .Net 4.0 Client Profile by default. Changing it to 4.0 full saved me from 20+ errors. – Talha Imam Mar 01 '17 at 12:57
38

Apparently when you select .NET framework 4.0 while creating the project, Visual Studio 2010 Beta 2 actually targets .NET framework 4 client profile. Change the target framework to .NET framework 4 using project properties.

alt text

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Hemant
  • 19,486
  • 24
  • 91
  • 127
  • cant find where I can change the target within visual web developer 2010 express. Please help, otherwise I have to create a new thread – Pascal Klein Oct 20 '10 at 02:16
  • @paskester: I don't have Visual Web Developer 2010 Express installed. Are you saying you cannot find above screen in project properties or you cannot find project properties itself? – Hemant Oct 20 '10 at 02:27
9

Please look at the following folder for System.ServiceModel.Web.dll

C:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\

Aliaksei Kliuchnikau
  • 13,589
  • 4
  • 59
  • 72
Sujoy
  • 99
  • 1
  • 1
  • Really Helpful, and the following path will also work. C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5 – Ashish-BeJovial Feb 24 '15 at 06:24
  • This is almost never the correct answer. If you have to have to manually navigate to `C:\Program Files\Reference Assemblies\` you have something misconfigured in your project and you need to fix that instead. – Scott Chamberlain Oct 16 '15 at 13:03
6

I use Visual Web Developer and facing the same issue. My project is already configured targetting .Net 4.0 Framework. The solution for my case is adding reference to my my project by :

right click on References, choose Add Reference and find System.ServiceModel.Web under .Net Tab

3

Check your project properties and on the Application tab make sure you have selected the full ".NET FRAMEWORK" and not ".NET FRAMEWORK CLIENT PROFILE" in the target framework combo.

Jude Fisher
  • 11,138
  • 7
  • 48
  • 91
-1

You can find the configuration with the below steps.

  1. Right Click Project in Solution Explorer

  2. Choose Properties

  3. Choose Compile TAB on the left

  4. At the end of the compile page click Advanced Compile Option*s Button, this will bring up the A*dvanced Compiler Settings

  5. The last control is a drop down reading "Target framework (all configurations)

-6

Add the following reference to your project

System.ServiceModel.Web.dll

If you are not able to find System.ServiceModel.Web in - 'Add Reference' click on Component Name to sort the list.

SohelElite
  • 87
  • 3
  • 3
  • 1
    Asker already said in his question that he tried adding a reference but couldn't find it. – Sean Aug 22 '11 at 23:52