Ninject integration in asmx web service

What is the best way to integrate Ninject into a Soap web service?

I tried with the NuGet package and Ninject.Wcf. But I get an error when I try to use the asmx service without a constructor without parameters.

The service looks like this:

public class Authentication : System.Web.Services.WebService { private readonly IDosReactingAuthentication dosReactingAuthentication; public Authentication(IDosReactingAuthentication dosReactingAuthentication) { this.dosReactingAuthentication = dosReactingAuthentication; } [WebMethod] public bool Auth(string domain, string username, string password) { return dosReactingAuthentication.Auth(domain, username, password); } } 

When I use the Auth() , I always get a System.MissingMethodException: no parameterless constructor defined for this object.

I also tried introducing properties, but the dependency is always zero.

+4
source share

Source: https://habr.com/ru/post/1484417/


All Articles