我正在尝试使用带有APIController的System.Web.Http库连接到WEB Api我已将路由配置设置为只有一个MapROute,因为我使用的应用程序仅用于webapi
routes.MapRoute(
name:="DefaultApi",
url:="api/{controller}/{action}/{id}",
defaults:=New With {.controller = "Home", .action = "Index", .id = UrlParameter.Optional}
)
控制器代码如下
Namespace Controllers
Public Class MobileAppController
Inherits ApiController
Function GetMedicineList()
Return "Connected to api"
End Function
End Class
End Namespace
我正在尝试访问我的网络api througgh http://localhost:51966/api/MobileApp/GetMedicineList
当我尝试在没有ApiController的情况下使用相同的功能时,它会给我发送cors origin错误404