Я использую .net Framework 4.5.2 и веб-API asp.net.
Я создаю новый контроллер с именем LoginVerification, и когда я запускаю приложение, я не вижу контроллер на вкладке API.,Кроме того, когда я пытаюсь получить или отправить в Почтальон, перейдя на http://localhost:51449/api/LoginVerification, я получаю следующую ошибку:
"Message": "No HTTP resource was found that matches the request URI 'http://localhost:51449/api/LoginVerification'.",
"MessageDetail": "No type was found that matches the controller named 'LoginVerification'."
Я не уверен, почему я не могу перейти кLoginVerification Controller.
[Authorize]
[RoutePrefix("api/LoginVerification")]
public class LoginVerificationController : ApiController
{
// GET api/<controller>
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/<controller>/5
public string Get(int id)
{
return "value";
}
// POST api/<controller>
public HttpResponseMessage Post([FromBody]string value)
{
string retVal = string.Empty;
LoginModel loginModel = new LoginModel();
retVal = loginModel.VerifyLoginValue(value);
return new HttpResponseMessage()
{
Content = new StringContent(retVal, Encoding.UTF8, "application/json"),
StatusCode = HttpStatusCode.OK
};
}
// PUT api/<controller>/5
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/<controller>/5
public void Delete(int id)
{
}
}