I have a pre-existing VB.NET web application running on IIS 8 in Windows Server 2012 R2. The application needs to handle a new API call (ex. localhost/test/ping) which I implemented using the APIController interface. I was able to successfully run the API call on my local Visual Studio, but once I deploy it to IIS, the url returns a 404 error.
After some digging and research, part of the problem I believe is the web app does not have ExtensionlessUrlHandler-Integerated-4.0 in the handler mapping. Looking into the configurations, apparently part of the pre-condition is the application cannot be me in classic mode, which mine is. I cannot switch to integrated mode which will break my app.
Is there a way around this limitation.
Update: Adding the web.config
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<add name="MVC" path="*." verb="*" type="" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="File" requireAccess="None" allowPathInfo="false" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="4194304" />
</handlers>
</system.webServer>
Update: Added Source Code
TestController.vb
<RoutePrefix("message")>
Public Class PingController
Inherits ApiController
Public Sub New() {
...
}
<Route("")>
<HttpGet>
Public Function GetMessage As String
Return "Hello World"
End Function
...
Global.asax
<script runat="server">
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
GlobalConfiguration.Configure(AddressOf WebApiConfig.Register)
End Sub
...
WebApiConfig.vb
Public Class WebApiConfig
Public Shared Sub Register(ByVal Configuration As HttpConfiguration)
Configuration.MapHttpAttributeRoutes()
End Sub
End Class