Do you have to install the REST starter kit in asp.net to access APIs?
I'm currently trying to access a REST API for the first time using visual web developer 2008 express edition.
开发者_开发百科Every article I have found says you have to install the WCF REST starter kit which is a .msi file, which would suggest that I have to install it on my machine and presumably our server too.
My question is this. Is there a non installable version that I can use, e.g. just by dropping DLLs into the Bin directory and then using the classes contained. Or is there more to it than that and am I just getting very confused about how it works?
Jon
You'll find that the msi just installs/registers the dlls and the Visual Studio project templates for common REST scenarios. See the first section of this article.
EDIT: Once referenced (you will have to browse to the install folder of the starter kit to add the reference), the dlls will be be copied to the output directory (because the CopyLocal property of the reference in VS will be true) so when you publish the project via VS (or compile) the dlls will be included in the bin folder (so no you will not have to install the starter kit on the server also).
When you install the WCF REST Starter kit it will create a folder
C:\Program Files (x86)\Microsoft WCF REST\WCF REST Starter Kit Preview 2\Assemblies
In this folder are the following DLLs.
Microsoft.Http.dll
Microsoft.Http.Extensions.dll
Microsoft.ServiceModel.Web.dll
The first two are used as a client library to access HTTP based interfaces. The third dll is an extension to WCF's System.ServiceModel.Web that fixes some of the problems with creating REST services using WCF.
The DLLs you need depend on whether you are trying to create a REST api, or consume an existing one.
The easiest way to use REST APIs in Visual Studio / Web Developer is to right click on your website in the Solution Explorer and go to Add Web Reference...
精彩评论