Question

I'm building a WCF WindowsService in .NET 4.0. I'd like to make it RESTfull and change the response and request type to JSON. To do that I need to use the WebGetAttribute under the OperationContract in the interface. But I can't find the System.ServiceModel.Web assembly (which is supposed to be in a System.ServiceModel.Web.dll according to MSDN). There's no trace of that DLL in the Add Reference form and if I try "using System.ServiceModel.Web;", it's not working either.

Do you have any idea what my problem is ?

Était-ce utile?

La solution

Starting with .NET Framework 4, you should no longer need to reference System.ServiceModel.Web.dll at all. The article is outdated, as starting with .NET Framework 4, all classes in System.ServiceModel.Web.dll simply forward to classes in System.Runtime.Serialization.dll and System.ServiceModel.dll.

So, my point is -- as long as you're NOT using the Client Profile of the .NET Framework -- just refer to System.Runtime.Serialization.dll and System.ServiceModel.dll, and you should be set.

Autres conseils

Well, turned out I was targeting ".NET Framework 4 Client Profile" which doesn't exposes all the DLLs. Thanks to this post. Changed it to ".NET Framework 4" and everything's OK.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top