Web API 2 RequireHttps allowing http connection
问题 I have created the following action in my MVC Web API 2 controller: [ResponseType(typeof(int))] [RequireHttps] public IHttpActionResult SaveLead(EcommerceLead lead) { } But in my test app I am making a call to http://localhost/api/savelead And it is working. Is there any way to make the action to only work if it is called over https, ie return a 404 if it isn't or something? 回答1: If you are using RequireHttps from Mvc namespace, it will not work with Web API. You can write a simple filter for