If this happens to you, a custom action invoker is likely to be the culprit. In my case, I was using Castle Windsor, and I had extended ControllerActionInvoker to provide dependency injection to my action filters. My action invoker looked something like this:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CastleActionInvoker : ControllerActionInvoker | |
{ | |
private IKernel kernel; | |
public CastleActionInvoker(IKernel kernel) | |
{ | |
this.kernel = kernel; | |
} | |
//... | |
} |
And this is how I had registered the action invoker with Windsor (this assumes you are using a controller factory that is aware of Windsor):
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Container.Register(Component.For<IActionInvoker>() | |
.ImplementedBy<CastleActionInvoker>() | |
.LifeStyle.Transient); |
All I had to change to fix the problem was to make my custom action invoker inherit AsyncControllerActionInvoker instead:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CastleActionInvoker : AsyncControllerActionInvoker | |
{ | |
//... | |
} |
AsyncControllerActionInvoker implements IAsyncActionInvoker and adds a few new methods. Depending on what you are trying to accomplish with your custom invoker, you may need to override a few of these new methods as well.
Interestingly enough, I did not have to change how the invoker was registered with Windsor.
This saved me some serious time
ReplyDeleteThis comment has been removed by the author.
ReplyDelete