我有一个带有aspx页面的WEB应用程序(没有数据库,非常简单的Web应用程序)。但现在我需要添加一些API服务。我会像在 MVC 中编程一样添加控制器,但这可能吗?我尝试但没有成功调用我的控制器,即使直接在 url 中
Imports Microsoft.AspNetCore.Mvc
<ApiController>
<Route("[Testouille]")>
Public Class LicencingYIController
Inherits ControllerBase
<HttpGet>
Public Function GetCustomHeader() As ActionResult(Of String)
Dim customHeader As String = Request.Headers("Custom-Header")
If String.IsNullOrEmpty(customHeader) Then
Return BadRequest("Custom header 'Custom-Header' is missing.")
Else
Return Ok("Received custom header: " & customHeader)
End If
End Function
End Class
我尝试从我的视觉工作室 https://localhost:myport/Testouille/GetCustomHeader 但什么都没有通过。我没有输入 GetCustomHeader 函数(断点)
然后我只是问是否有可能或者最终更好地制作一个asmx?
感谢您的帮助。
不,创建新的更容易。