When I try to publish my web API to a server I get the following messages
"No HTTP resource was found that matches the request URI" "No type was found that matches the controller named 'test'."
Everything works on my machine locally. Just trying to get a test controller to work, then work my way up to fixing the other controllers, hence why I have other register routes in my web API.
http://localhost:4159/api/test/1
http://intranetserver/project/api/test/1
here's the controller
Public Class TestController
Inherits ApiController
Public Function GetValue(ByVal id As Integer) As String
Return "value"
End Function
here's the WebApiConfig.vb
Public Class WebApiConfig
Public Shared Sub Register(ByVal config As HttpConfiguration)
config.Routes.MapHttpRoute( _
name:="DefaultApi", _
routeTemplate:="api/{controller}/{id}", _
defaults:=New With {.id = RouteParameter.Optional} _
)
' config.Routes.MapHttpRoute( _
' name:="GetVehiclesByDateRange", _
' routeTemplate:="api/{controller}/{startDate}/{endDate}" _
')
config.Routes.MapHttpRoute( _
name:="GetImportersByDateTimeRange", _
routeTemplate:="api/{controller}/{startDateTime}/{endDateTime}" _
)
config.Routes.MapHttpRoute( _
name:="GetPagedData", _
routeTemplate:="api/{controller}/{pageNumber}/{pageSize}" _
)
End Sub
End Class
here's what found in the Global.asax.vb file
Sub Application_Start()
AreaRegistration.RegisterAllAreas()
WebApiConfig.Register(GlobalConfiguration.Configuration)
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters)
RouteConfig.RegisterRoutes(RouteTable.Routes)
BundleConfig.RegisterBundles(BundleTable.Bundles)
CorsConfig.RegisterCors(GlobalConfiguration.Configuration)
''NOTE: Remove the Basic Authentication mechanism below to open the service to all calls. And also comment out any attributes on Controllers.
GlobalConfiguration.Configuration.MessageHandlers.Add(New BasicAuthMessageHandler() With {.PrincipalProvider = New DummyPrincipalProvider()})
End Sub
Any Ideas?