Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity.Wcf / does not implement inherited abstract member AND no suitable method found to override

This class was generated by NUGET after installing Unity.Wcf

public class WcfServiceFactory : UnityServiceHostFactory
    {
        protected override void ConfigureContainer(IUnityContainer container)
        {
            // register all your components with the container here
            // container
            //    .RegisterType<IService1, Service1>()
            //    .RegisterType<DataContext>(new HierarchicalLifetimeManager());
        }
    } 

This is the class that is being inherited:

 public abstract class UnityServiceHostFactory : ServiceHostFactory
    {
        protected UnityServiceHostFactory();

        protected abstract void ConfigureContainer(IUnityContainer container);
        protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses);
    }

Somehow I keep getting these 2 errors:

'ServiceImplementation2.WcfServiceFactory' does not implement inherited abstract member 'Unity.Wcf.UnityServiceHostFactory.ConfigureContainer(Microsoft.Practices.Unity.IUnityContainer)'

and

'ServiceImplementation2.WcfServiceFactory.ConfigureContainer(Microsoft.Practices.Unity.IUnityContainer)': no suitable method found to override

There are no differences in the parameters.

Even autogenerating the method gets me errors.

I am using VisualStudio2013.

like image 543
Dragos Durlut Avatar asked Feb 08 '23 01:02

Dragos Durlut


1 Answers

I had the same issue when working with Unity 4.0.1, but then the issue was disappeared after downgrade to Unity 3.5.1404. Looks to me like Unity.Wcf doesn't work well with 4.0.1.

To install unity version 3.5

Install-Package Unity -Version 3.5.1404

Hope this help.

like image 89
Roath So Avatar answered Feb 09 '23 13:02

Roath So