HI,
I'm working in web api project using Visual studio 2017 in VB language
I've created some controllers and they're working fine on my pc and online,
then I've created new controllers using the same code as the old ones and they are working fine on my pc but when I call them from the hosting online I get the 404 response "No type was found that matches the controller named"
What I have tried:
an example of a working controller:
Imports System.Web.Http
Namespace Controllers
Public Class BanksController
Inherits ApiController
Dim Table As String = "Banks"
' GET: api/Banks
Public Function GetValues() As Object
Return SqlToJson("SELECT BankId, BankName FROM " & Table)
End Function
' GET: api/Banks/5
Public Function GetValue(ByVal id As Integer) As Object
Return SqlToJson("SELECT BankId, BankName FROM " & Table & " Where BankId = " & id)
End Function
' POST: api/Banks
Public Function PostValue(<FromBody()> ByVal value As Object) As Object
Return InsertFromJson(value, Table)
End Function
' PUT: api/Banks/5
Public Function PutValue(ByVal id As Integer, <FromBody()> ByVal value As Object) As Object
Return UpdateFromJson(value, Table, " Where BankId = " & id)
End Function
' DELETE: api/Banks/5
Public Function DeleteValue(ByVal id As Integer) As Object
Return DeleteRecord(Table, " Where BankId = " & id)
End Function
End Class
End Namespace
an example of a controller who responses with 404
Imports System.Web.Http
<pre lang="vb">Namespace Controllers
Public Class BuildingsController
Inherits ApiController
Dim Table As String = "Buildings"
' GET: api/Buildings
Public Function GetValues() As Object
Return SqlToJson("SELECT * FROM " & Table)
End Function
' GET: api/Buildings/5
Public Function GetValue(ByVal id As Integer) As Object
Return SqlToJson("SELECT * FROM " & Table & " Where BuildingId = " & id)
End Function
' POST: api/Buildings
Public Function PostValue(<FromBody()> ByVal value As Object) As Object
Return InsertFromJson(value, Table)
End Function
' PUT: api/Buildings/5
Public Function PutValue(ByVal id As Integer, <FromBody()> ByVal value As Object) As Object
Return UpdateFromJson(value, Table, " Where BuildingId = " & id)
End Function
' DELETE: api/Buildings/5
Public Function DeleteValue(ByVal id As Integer) As Object
Return DeleteRecord(Table, " Where BuildingId = " & id)
End Function
End Class
End Namespace