I have a MessageHandlers called MetadataHandler in my web api which is shaping the data just before returning back to the client. When I add the CachCow I get this error "This operation is not supported for a relative URI."
Here is the MetaDataHandler:
public class MetadataHandler : DelegatingHandler
{
protected override Task SendAsync(HttpRequestMessage request,
CancellationToken cancellationToken)
{
return base.SendAsync(request, cancellationToken).ContinueWith(
task =>
{
//The error happens here on this line
//task: Id = 68, Status = Faulted, Method = "{null}", Result = "{Not yet computed}"
if (ResponseIsValid(task.Result))
{
AddMetaDataToResponse
return task.Result;
});
}
...
}
And this is how I registered CachCow in WebApiConfig:
Hi Ali,
I have a MessageHandlers called MetadataHandler in my web api which is shaping the data just before returning back to the client. When I add the CachCow I get this error "This operation is not supported for a relative URI."
Here is the MetaDataHandler:
public class MetadataHandler : DelegatingHandler { protected override Task SendAsync(HttpRequestMessage request,
CancellationToken cancellationToken)
{
return base.SendAsync(request, cancellationToken).ContinueWith(
task =>
{
//The error happens here on this line
//task: Id = 68, Status = Faulted, Method = "{null}", Result = "{Not yet computed}"
if (ResponseIsValid(task.Result))
{
AddMetaDataToResponse
... }
And this is how I registered CachCow in WebApiConfig:
config.MessageHandlers.Add(new MetadataHandler()); config.MessageHandlers.Add(new CachingHandler(config));
I have a feeling that the thread is getting blocked somewhere according to this: http://stackoverflow.com/questions/24326043/deadlock-reading-async-response-content-from-async-delegatinghandler-in-webapi
I appreciate if you can help solving this, thanks.