Tech Off Thread

2 posts

Solved: RESTful WCF implementation through MEF

Back to Forum: Tech Off
  • User profile image

    I've been spending the last 3 hours reading 30 unique examples of combining the new WebHttp API in .NET 4 (a.k.a REST) with MEF (yet another IoC framework).

    (Global.asax.cs)     var configuration = HttpHostConfiguration.Create()  
        .SetResourceFactory(new MyCustomResourceFactory(container));  
    RouteTable.Routes.MapServiceRoute<ContactsResource>("contacts", configuration);

    This example does exactly what I want. But HttpHostConfiguration and the MapServiceRoute both seem to be deprecated (Probably a part of the old starter kit). I cant use the normal ServiceRoute because that requires a class, but all I got is a interface since they are loosely coupled.

    I have also tried implementing the IInstanceProvider but to no avail.

    This is my last resort, google is refusing to help me. :argh:

  • User profile image

    I was missing the WCF Web API (Preview 4) It was surprisingly hard to find!

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.