InvalidOperationException - the type has no constructor available

I'm having trouble resolving WCF using Unity.

WCF Channel Registration below

 string serviceUrl = "http://localhost:8000/AdvancedPersonSelectService.svc";
    IocContainer.Instance.RegisterType<IPersonAdvancedPersonSelectService, AdvancedPersonSelectService>(                      
                   new InjectionFactory(
                   c => WcfClientProxyBuilder.CreateProxy<IPersonAdvancedPersonSelectService>(serviceUrl)));

IocContainer.Instance is a Unity container
wcfClientProxyBuilder returns a WCF channel.

Allowing this to

      var personAdvancedPersonSelectService = IocContainer.Instance.Resolve<IPersonAdvancedPersonSelectService>("AdvancedPersonSelectService");
        var getUserNameresponse = personAdvancedPersonSelectService.GetUserName(request);

At this time I get an error

Dependency resolution failed, type = "Healthphone.ConcordiaCCMS.Common.ServiceContracts.IPersonAdvancedPersonSelectService", name = "AdvancedPersonSelectService". An exception occurred when: at resolution.

Exception: InvalidOperationException - type IPersonAdvancedPersonSelectService does not have an available constructor.

At the time of the exception, the container was:

Healthphone.ConcordiaCCMS.Common.ServiceContracts.IPersonAdvancedPersonSelectService, AdvancedPersonSelectService Solution

, , , .

- .

.

+1

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


All Articles