Search code examples
jqueryasp.net-mvcasp.net-web-apimef

Debug VS 2012 asp.net mvc jquery webapi MEF


I'm developing an ASP.net MVC project as part of a larger solution. The MVC project uses the following technologies:

MVC WebAPI jquery MEF

Views are rendered using MVC. jQuery REST calls made to webAPI controllers for updating parts of the view.

I'm using MEF resolve the MVC and WebAPI controllers and any other dependencies.

Right now, I'm not able to resolve any of the WebAPI calls. What do I need to do to debug problems with MEF resolution?

Thanks in advance.


Solution

  • You can use MEFX to help diagnose composition errors (http://msdn.microsoft.com/en-us/library/ff576068(v=vs.100).aspx.

    If you're not getting any exceptions, I would add a breakpoint somewhere after you're doing composition and look at the Parts property of the container, to see if the parts you expect to be there are there. If they're not, you should be able to use MEFX to figure out why not.