9

I can't find [WebInvoke] and [WebGet]. I have already add System.ServiceModel reference. what is the problem? I use .NET Framwork 4

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Darshana
  • 2,462
  • 6
  • 28
  • 54

3 Answers3

23

You need to add a reference to the System.ServiceModel.Web.dll. Notice that you need to target the full .NET Framework (either 3.5 or 4.0) - if your application is targeting the client profile for those frameworks, this assembly won't be available.

carlosfigueira
  • 85,035
  • 14
  • 131
  • 171
  • thanx I think it was the problem – Darshana Mar 21 '12 at 05:21
  • Not having any luck with mine - I am trying to convert a Silverlight 4 --> Silverlight 5 under .NET 4.5.2 - I have added the System.ServiceModel.Web.dll , still no luck... thoughts? – Nutshell Oct 26 '15 at 17:59
2

Need to add the reference System.ServiceModel.Web.dll and import the namespace System.ServiceModel.Web by using below statement using System.ServiceModel.Web; Then it will work.

Software Craftsman
  • 2,999
  • 2
  • 31
  • 47
  • This helped me more than the accepted answer, because it mentions the correct using directive. My DLL reference was OK, but i was missing the using directive (my code was copied from a tutorial). I vote this up. – Software Craftsman Jun 20 '16 at 13:20
0

When using attributes "Attribute" portion of the class is implied.

WebInvoke - WebInvokeAttribute

WebGet - WebGetAttribute

Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179