I\'m looking for the best way to incorporate a classic asmx web service into my MVC3 environment. I\'d like the kernel/container to be shared between the two.
In th
The MVC framework supports the DependencyResolver which integrates with Ninject for MVC. Although it is not possible to define a custom factory for ASMX web services, you could do the following:
public class Service : WebService
{
public IContextProvider ContextProvider {get;set;}
public Service()
{
ContextProvider = DependencyResolver.Current.GetService<IContextProvider>();
}
}
While you cannot inject dependencies during construction of your service, you are able to resolve them yourself within the constructor.