You need to add the client context on the request if that not already is there (some information about the context can be found in this thread Moving ClientContext to external call). You also need to ensure that you are building all the data that you are returning before you return result as an IHttpActionResult
. If you return an object that not is populated like an IEnumerable<T>
that will be populated when it is executed you are out to have trouble and should change them to be populated inside the execution block (example adding .ToList()
of them so they are populated directly).