You will get the issue Multiple actions were found that matches the request
for report viewer and report designer Web API in the ASP.NET MVC application controller, when Web API is not routed properly with action. You have to create all the Web API methods with ActionName
and NonAction
attributes as like below,
public class ReportApiController : ApiController, IReportController
{
[System.Web.Http.ActionName("PostReportAction")]
// Post action for processing the RDL/RDLC report
public object PostReportAction(Dictionary<string, object> jsonResult)
{
return ReportHelper.ProcessReport(jsonResult, this);
}
// Get action for getting resources from the report
[System.Web.Http.ActionName("GetResource")]
[AcceptVerbs("GET")]
public object GetResource(string key, string resourcetype, bool isPrint)
{
return ReportHelper.GetResource(key, resourcetype, isPrint);
}
[NonAction]
// Method that will be called when initialize the report options before start processing the report
public void OnInitReportOptions(ReportViewerOptions reportOption)
{
// You can update report options here
}
[NonAction]
// Method that will be called when reported is loaded
public void OnReportLoaded(ReportViewerOptions reportOption)
{
// You can update report options here
}
}