Tuesday, June 29, 2010

Setup Restful service development environment on Visual Studio 2010

Setting up Visual Studio
Publish the solution to your local IIS in order to test the REST interface properly.
1. Build the Solution.
2. Right click on the Service Project and select "Publish".
3. Name the Publish Profile.
4. In the "Publish method" drop down list, select "Web Deploy".
5. In the "Service URL" box, enter "localhost".
6. In the "Site/application" box, enter "Default Web Site/v1".
7. Make sure that "Mark as IIS application on destination" is checked.
8. Click "Save" in the upper right hand corner.
9. Click "Publish".
IIS Settings
1. Security - Make sure that the "Directory Security" for the v1 Web Application is set to anonymous only. By default, both anonymous and windows authentication
will be enabled, but WCF/REST cannot have 2 different types of authenticaton modes enabled.
2. Default Web Site Application Settings
    1. Bring up the properties window of the Default Web Site in your local IIS manager.
    2. Click on the "Home Directory" tab and then on the "Configuration..." button.
    3. On the "Mappings" tab, you will need to add a new application mapping.
        1. Click on "Add"
        2. For the "Executable" field, browse to the .Net 4.0 ASPNET_ISAPI dll (usually here "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll")
        3. In the "Extension" field, type ".*"
        4. Make sure that "Script engine" is checked.
        5. MAKE SURE THAT "Check that file exists" IS NOT CHECKED!
        6. Click "Ok". NOTE: If the "Ok" button is still disabled, click back in the "Executable" box, and the "Ok" should be enabled.
    4. Restart IIS (run the "iisreset" command).

IIS Configuration for web service on Windows XP

Set IIS configuration to accept *.
.* is not allowed when ADD.
Click the INSERT button instead.