本文介绍了StructureMap和SignalR - IMessageBus,没有默认实例定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用的NuGet更新我的项目signalr 2.2和结构图2.6.4。结果
现在,当我的程序尝试使用SignalR,结构图是抛出这个错误:

I used nuget to update my project to signalr 2.2 and structure map 2.6.4.
Now when my program attempts to use SignalR, structure map is throwing this error:

    StructureMap.StructureMapException was unhandled by user code
      HResult=-2146232832
      Message=StructureMap Exception Code:  202
    No Default Instance defined for 
PluginFamily Microsoft.AspNet.SignalR.Messaging.IMessageBus, Microsoft.AspNet.SignalR.Core, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
      Source=StructureMap

我的code并没有改变,我不认为我需要的任何地方IMessageBus,所以我不知道为什么结构图,现在这样做。我设置了简单的structuremap 2.6.4 / 2.2 signalr,绝不需要种子IMessageBus一个新的项目,所以这件事情对我的实现,但我不知道什么是从升级改变。

My code hasn't change and I don't believe I'm requiring IMessageBus anywhere, so I'm not sure why structure map is now doing this. I setup a new project with a simplified structuremap 2.6.4/signalr 2.2 and never need to seed IMessageBus, so it's something about my implementation, but I'm not sure what's changed from the upgrade.

有没有人有一个想法,我指向?

Does anyone have an idea to point me to?

谢谢!
斯科特

Thanks!Scott

推荐答案

这是首先寻找在基类来解决解决:

This was solved by first looking to resolve in the base class:

public override object GetService(Type serviceType)
{
        if (serviceType == null)
            return null;

var service = base.GetService(serviceType);
        if (service != null) return service;

return container.TryGetInstance(serviceType);

}

这篇关于StructureMap和SignalR - IMessageBus,没有默认实例定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 07:54