开发者

Why I am not getting WCF Web API Objects in Visual Studio 2010

开发者 https://www.devze.com 2023-04-12 12:27 出处:网络
I have installed WCF Web API Preview 5 using NuGet Visual Studio extension (WebApi.All). I am trying to 开发者_StackOverflow社区implement some simple examples on the internet, but it seems like they h

I have installed WCF Web API Preview 5 using NuGet Visual Studio extension (WebApi.All). I am trying to 开发者_StackOverflow社区implement some simple examples on the internet, but it seems like they have different Assemblies to the ones I installed. For example, I cannot get HttpHostConfiguration, DelegatingChannel, HttpMessageChannel, etc.

I have made sure my target framework is set to ".NET Framework 4". Am I missing something, or has anyone else experienced a similar issue. Btw, my project is an MVC3 project.

Thanks for your help.


It sounds like the sample code you are trying to use is from preview 4 or before. A number of breaking changes where made in preview 5.

To get the Http server configuration you can use the GetDefaultHttpConfiguration() extension method on the RouteCollection. The DelegatingChannel has been renamed to DelegatingHandler.

See the release notes here or this blog post from Howard Dierking for more info.


You need to add a reference to the dll that contains those classes. They are probably not referenced by default in a MVC3 project.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号