- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图在我的 Controller 中使用“PUT”
public class HomeController : Controller
{
[HttpPut]
public ContentResult Test()
{
return Content("hi");
}
}
但是我无法访问它。我以为这是我的代码,但在尝试 fiddler 并得到相同的错误 (404) 之后。
我想还有别的事情发生了。我只使用 iis express 和 mvc 5。
在我从未使用过 HttpPut 但最近一直在使用 webapi 之前,这就是我尝试在 mvc 5 Controller 中使用它的原因,但我不确定在这种情况下它是否会给我带来任何东西(尤其是需要额外的设置,因为它看起来像是需要的)
发布请求有效
最佳答案
另一种可能性是更新 ExtensionlessUrlHandler-Integrated-4.0。
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
可以在以下位置找到此解决方案: Attribute routing with http PUT method constraint
关于c# - Asp.net Mvc 5 中的 HttpPut?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23230670/
System.Web.Http.HttpPut 和 System.Web.Mvc.HttpPut 有什么区别? 在 Web API 项目上使用 [HttpPut] 会导致错误 405 - 请求的资源不
我正在使用ouchdb服务器端在本机android应用程序上工作。 每当我尝试将附件上传到文档时,都会抛出ClientProtocolException public JSONObject uploa
我正在尝试修改数据库 (MySQL) 的值。对于这个问题,我在我的 Android 应用程序上使用 HttPut ,并使用 Slim Framework 作为带有 XAMPP 的 PHP 微型框架用于
如何在 Android 上编写带身份验证的 HttpPut 请求? (我正在尝试使用 HttpURLConnection,这似乎有严重的错误(至少在 Android 2.2 中)但 GET 工作正常。
我有一个小问题。我正在 http://www.thomas-bayer.com/sqlrest/CUSTOMER 上测试我的 Android REST 类演示 REST 服务。 Get方法可以,但是我
我试图在我的 Controller 中使用“PUT” public class HomeController : Controller { [HttpPut]
我想从 Android 应用程序上传一些数据到 Pachube。 [更新:对于 2013 年阅读本文的人来说,“Pachube”变成了“Cosm”,现在是“Xively”。] This hurl由他们
我将 Apache DefaultHttpClient 与 HttpPut 结合使用,使用 REST API 进行文件上传。从 Windows 运行时非常慢,它发送 240 kb/秒。但是当我从 MA
我正在尝试学习如何操作 scala 和 key-value etcd。我知道如何发布和从中获取数据。至少整个 key 。在这种情况下,整个“testDistrict”及其包含的所有内容。但我不知道如何
我尝试从我的 Android 设备连接到 REST 网络服务并在那里放置一些数据,但我得到的只是一个 GET 结果。甚至我的网络服务器也坚持认为这是一个 GET 请求。我的代码有什么问题? Defau
我有一个服务类,它调用 REST API 来获取、创建、更新和删除订阅者。 Uri 保持不变,但 HTTP 方法如您所料发生变化。我想测试给出的方法是否正确。下面是 updateSubscriber
我是 MVC Web Api 的新手。 我想要两种不同的方法。 PUT localhost/api/user - 修改用户 POST localhost/api/user - 添加用户 所以我的 Ap
在 ASP.NET MVC 2 中,引入了几个新的操作过滤器属性,作为 ASP.NET MVC 1 中属性的“简写”;例如,应用 HttpPostAttribute 与将 [AcceptVerbs(H
我从根本上理解我的程序中的这段代码正在实现什么目的。然而,由于对这里发生的事情了解有限,在我看来可能有更好的方法来做到这一点。 // Accept ALL certificates by ov
我正在尝试使用 Apache HttpClient 4.5.6 通过 HttpPut 上传 InputStream: InputStream inputStream = .. CredentialsP
我目前正在使用 HttpPost 和 HttpPut 将实体从我的移动应用程序发送到服务器。我正在使用 setEntity 将实体从数据库发送到服务器,它简单、直接并且运行良好,但它现在已从版本 23
我正在尝试在 ASP.NET MVC 中创建一个 api。不幸的是,我遇到了两个 HTTP 请求的问题:DELETE 和 PUT [ActionName("Index")] [Http
我无法访问此方法: [HttpPut] [Route("api/Order/Update/{id}")] public async Task UpdateList([FromBody]OrderVie
我是一名优秀的程序员,十分优秀!