404 error Web Api on Windows 2008 Server R2

Topics: Web Api
Nov 9, 2011 at 6:29 PM

Hi, 

I am struck on to deploy Web Api app on windows 2008 R2.

I am getting 404 error when browsing service.

I pounced thru web and tried most solutions and didn't work.

Please advise any pointers you may know.

Thank you

V

Coordinator
Nov 9, 2011 at 6:37 PM

Could you please show us your code that you are using to host the Web API?

Daniel Roth

Nov 9, 2011 at 7:03 PM

 

using System;using System.Web.Routing;

using System.Collections.Generic;

using Microsoft.ApplicationServer.Http.Activation;


[assembly: WebActivator.PreApplicationStartMethod(typeof(Restaurant.App_Start.WebApi), "Start")]


namespace Restaurant.App_Start {   

public static class WebApi {       

public static void Start() {           

// TODO: change "MyModel" to desired route segment           

RouteTable.Routes.MapServiceRoute<SampleService.Resources.RestaurantService>("RestaurantServices");        }    }}

I put this code in App_Start directory

Then try to browse http://www.mydomain.com/RestaurantServices/ListLocations(XXXX)

I tried ContactManager sample as well on same server. It shows same error on browsing  http://localhost/test