在web api 2上没有找到任何操作

时间:2015-09-03 15:29:02

标签: asp.net asp.net-web-api routing

你能告诉我我做错了吗?

此控制器工作正常:

void quickSort(std::vector<long>& numberList, long low, long high)
{
    struct lh { long low; long high; };
    std::vector<lh> stack;
    stack.push_back(lh{low, high});

    while (!stack.empty())
    {
        lh popped = stack.back();
        stack.pop_back();
        low = popped.low;
        high = popped.high;

        long pivot, indexLow, indexHigh, temp;

        if(low<high){
            pivot = low;
            indexLow = low;
            indexHigh = high;

            while(indexLow<indexHigh){
                while(numberList[indexLow] <= numberList[pivot]){
                indexLow++;
                }
                while(numberList[indexHigh] > numberList[pivot]){
                indexHigh--;
                }

                if(indexLow<indexHigh){
                    temp = numberList[indexLow];
                    numberList[indexLow] = numberList[indexHigh];
                    numberList[indexHigh] = temp;
                    }
            }

            temp = numberList[pivot];
            numberList[pivot] = numberList[indexHigh];
            numberList[indexHigh] = temp;

            //quickSort(numberList, low, indexHigh-1);
            stack.push_back(lh{low, indexHigh-1});

            //quickSort(numberList, indexHigh+1, high);
            stack.push_back(lh{indexHigh+1, high});
        }
    }
}

我收到了这个回复:

[Route("Create")]         
[HttpPost]         
public async Task<IHttpActionResult> Register(RegisterBindingModel model)
{
}

//But this one is not :` [Route("FindByEmail")]

[HttpGet]
// [ActionName("FindByEmail")]
// [NonAction] 
public async Task<IHttpActionResult> FindByEmail(string email)
{
}

这是我的web.config文件`config.MapHttpAttributeRoutes();

的一部分
<Error>
<Message>
No HTTP resource was found that matches the request URI 'http://localhost:35181/api/Account/FindByEmail'.
</Message>
<MessageDetail>
No action was found on the controller 'Account' that matches the request.
</MessageDetail>
</Error> 

我尝试了几种不同的路由并阅读了很多帖子和Microsoft文档,但我仍然无法找到解决方案。

0 个答案:

没有答案