目前我的设置包括两个位于同一C#文件中的WebAPI端点(POST和DELETE):
[HttpPost] [Route("api/authorizations/create/{id}")] public IHttpActionResult CreateAuthorization(string id); [HttpDelete] [Route("api/authorizations/delete/{id}")] public IHttpActionResult DeleteAuthorization(string id);我可以使用Postman成功地将邮件发送到第一个终端,但是当我尝试向第二个终端发送DELETE请求时,我收到以下消息
404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.在本地测试这两个端点工作得很好,但是当我将我的项目上传到Staging环境时,我只能访问POST端点。
任何想法,为什么我只能访问一个? 同样,这两个端点位于同一个控制器文件中。
Currently the setup I have includes two WebAPI endpoints (POST and DELETE) that are located within the same C# file:
[HttpPost] [Route("api/authorizations/create/{id}")] public IHttpActionResult CreateAuthorization(string id); [HttpDelete] [Route("api/authorizations/delete/{id}")] public IHttpActionResult DeleteAuthorization(string id);I can POST to the first endpoint successfully using Postman, but when I attempt to send a DELETE request to the second endpoint I get the following message
404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.Testing both of these endpoints locally worked just fine, but when I upload my project to a Staging environment I'm only able to access the POST endpoint.
Any idea why I can only access one? Again, these two endpoints are located within the same Controller file.
最满意答案
检查您的运行时托管环境。 如果它是像IIS(或任何其他)的东西, DELETE动词可能未启用。
Check your runtime hosting environment. If it's something like IIS (or any other), DELETE verb mightn't be enabled.
更多推荐
发布评论