문제

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 ?

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top