5

I started getting a strange error on publish in one our our dev sitecore instances that seems to be coming from some Sitecore.Social.Client piplines.

Exception[1]: Ninject.ActivationException Message[1]: Error activating ILogManager No matching bindings are available, and the type is not self-bindable. Activation path: 1) Request for ILogManager

Suggestions: 1) Ensure that you have defined a binding for ILogManager. 2) If the binding was defined in a module, ensure that the module has been loaded into the kernel. 3) Ensure you have not accidentally created more than one kernel. 4) If you are using constructor arguments, ensure that the parameter name matches the constructors parameter name. 5) If you are using automatic module loading, ensure the search path and filters are correct.

Source1: Ninject at Ninject.KernelBase.Resolve(IRequest request) at Ninject.ResolutionExtensions.Get[T](IResolutionRoot root, IParameter[] parameters) at Sitecore.Social.Client.MessagePosting.Handlers.PublishEndHandler.DoClearDbMesageCache(EventArgs args) at Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName, Object[] parameters, EventResult result) ...

We use AutoFac for DI and manually adding a registration for ILogManager to the AutoFac container didn't seem to resolve this issue. I decompiled the dll to see what the offending line was and it was apparently trying resolve IlogManager to log an exception (which wasn't logged because it threw in the catch).

try
  {
    using (new SiteContextSwitcher(SiteContext.GetSite("shell")))
    {
                    ItemProcessedEventArgs processedEventArgs = args as ItemProcessedEventArgs;
                    if (processedEventArgs == null || processedEventArgs.Context.Result.Operation != PublishOperation.Created && processedEventArgs.Context.Result.Operation != PublishOperation.Updated || processedEventArgs.Context.VersionToPublish == null)
                        return;
                    IMessageManager messageManager = (IMessageManager)Ninject.ResolutionExtensions.Get<IMessageManager>((IResolutionRoot)ExecutingContext.Current.IoC, new IParameter[0]);
                    foreach (Message message in messageManager.GetMessagesByContainer(processedEventArgs.Context.VersionToPublish.Uri.ToString()).Where<Message>((Func<Message, bool>)(message => message.PostingConfiguration is ContainerPostingConfiguration)).ToList<Message>())
                    {
                        //do message things
                    }
    }
  }
  catch (Exception ex)
  {
     //blows on this next line
    ((ILogManager) ResolutionExtensions.Get<ILogManager>((IResolutionRoot) ExecutingContext.Current.IoC, new IParameter[0])).LogMessage(ex.Message, Sitecore.Social.Infrastructure.Logging.LogLevel.Error, (object) this, ex);
  }

I don't want add Ninject and wire up a seperate IOC container if I can avoid it. I'm considering just disabling Sitecore Social altogether but I figured I'd see if there is a better way. I have a different site with identical configs that doesn't have this publishing issue and nothing seemed strange in showconfig.

Any ideas? I saw this community post about the same issue but there is no resolution there.

Update

I went through and created a Pipeline override and brought my own logging in to see if I could get the original exception. Since it was failing in the catch clause, I figured the root exception might be more helpful. Unfortunately it just turned out to be a different Ninject Activation error.

//blows up here
IMessageManager messageManager = (IMessageManager)Ninject.ResolutionExtensions.Get<IMessageManager>((IResolutionRoot)ExecutingContext.Current.IoC, new IParameter[0]);

Exception: Ninject.ActivationException Message: Error activating IMessageManager No matching bindings are available, and the type is not self-bindable. Activation path: 1) Request for IMessageManager

So it looks like it is not specific to ILogManager since the previous call to resolve IMessageManager also fails. More of a global problem with this Ninject.ResolutionExtensions.Get<IMessageManager> call.

3
  • Hi @Rondel, have you found any solution? I am experiencing the same issue on 8.2 update 6, couldn't find any clue (My solution is using the sitecore 8.2 default DI)
    – Vincent
    Oct 9 '18 at 2:49
  • @Vincent I never figured this out unfortunately. I ended up completely disabling Sitecore Social as a workaround because we weren't using it. Your best bet may be the nuclear option and trying a clean install to see if that magically fixes the problem
    – Rondel
    Oct 9 '18 at 18:37
  • I resolved this by commenting out the line <setting name="Social.IoC.AssemblyFullName" value="Ninject, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7" /> in Sitecore.Social.config.
    – Neo
    Aug 7 '19 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.