Custom ActionFilter of web api gives timeout when stored procedure is called

Viewed 11

Below is the sample code snippet-

I have a controller which gets the percentage of student

[ValidateRequest]
[HttpGet]
public Student GetTotalPercentage([FromBody] Student studentData)
{
    // code to calculate and return percentage
}

Below is the code sample of my custom action filter ValidateRequest

public class ValidateRequest : ActionFilterAttribute
{
    public override void OnActionExecuting(HttpActionContext actionContext)
    {
        var requestModel = actionContext.ActionArguments["studentData"];
        var studentData = (Student)requestModel;
        
        int studentId = studentData.id;
        
        // Pass the studentId to a stored procedure to verify whether the student with that id exists or not
    }
}

In this scenario, the api call just hangs and times out after 2-3 minutes. Whereas, if i call the stored procedure from the controller method, then it works fine.

If there any restriction on ActionFilters pertaining to SP calls?

0 Answers
Related