0

I've upgraded from .NET 4.8 framework to .NET 7 and I can't seem to get rid of the following error;

The type 'CoreWCF.ServiceHostBase' cannot be used as type parameter 'T' in the generic type or method 'UnityWcfLifetimeManager<T>'

using CoreWCF;
using Unity.Lifetime;

namespace Chiro.Cdf.UnityWcfExtensions
{
    /// <summary>
    /// Unity lifetime manager to support <see cref="ServiceHostBase"/>.
    /// </summary>
    public class UnityServiceHostBaseLifetimeManager : UnityWcfLifetimeManager<ServiceHostBase>
    {
        /// <summary>
        /// Returns the appropriate extension for the current lifetime manager.
        /// </summary>
        /// <returns>The registered extension for the current lifetime manager, otherwise, null if the extension is not registered.</returns>
        protected override UnityWcfExtension<ServiceHostBase> FindExtension()
        {
            return UnityServiceHostBaseExtension.Current;
        }

        protected override LifetimeManager OnCreateLifetimeManager()
        {
            throw new System.NotImplementedException();
        }
    }
}

I've tried a lot of solutions I saw on the internet, but nothing really seems to work

2
  • What is UnityWcfLifetimeManager?
    – Guru Stron
    Commented Jun 19, 2023 at 13:36
  • Hmmm... WCF and Life time management aren't really supported in .NET 6.0 any more. I'm not sure what this class is used for, but try to just delete it.
    – PMF
    Commented Jun 19, 2023 at 17:32

0