Dragos Durlut
Dragos Durlut

Reputation: 8098

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.

Upvotes: 4

Views: 1560

Answers (2)

Ole Kristian
Ole Kristian

Reputation: 41

Instead of downgrading Microsoft.Practices.Unity, you can instead upgrade Unity.Wcf. I will guess you are using Unity.Wcf 1.0.0. By using this version of Unity.Wcf you will not get a compilation error:

UnityWCF page at nuget

Upvotes: 4

Roath So
Roath So

Reputation: 141

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.

Upvotes: 4

Related Questions