StructureMap异常代码:202没有为PluginFamily定义的默认实例NServiceBus.IBus,NServiceBus,Version = 2.6.0.1504

时间:2013-02-25 03:38:54

标签: c# javascript json

Ex me ,,, 我的代码中有问题,
我想在我的程序中创建POS,
但我有消息错误

  

StructureMap异常代码:202没有为PluginFamily定义的默认实例NServiceBus.IBus,NServiceBus,版本= 2.6.0.1504,Culture = neutral,PublicKeyToken = 9fc386479f8a226

这是我的剧本, 任何人都可以帮助我,,,

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Nancy;
using Nancy.Security;
using dokuku.pos.setting;
using StructureMap;
using NServiceBus;
using dokuku.sales.pos.messages;
using System.IO;
using Nancy.IO;

namespace dokuku.pos.web.modules
{
    public class PosSettingModule : Nancy.NancyModule
    {
        public PosSettingModule()
        {
            this.RequiresAuthentication();
            Post["card/addcard.json"] = p =>
            {
                string addCard = getJson(this.Request.Body);
                try
                {
                    POSCard cards = this.CardService().Insert(addCard, this.CurrentAccount().OwnerId);
                    PublishCardCreated(cards);
                    return Response.AsJson(cards);
                }
                catch (Exception ex)
                {
                    return Response.AsJson(new { error = true, message = ex.Message });
                }
            };

private void PublishCardCreated(POSCard cards)
{
    ObjectFactory.GetInstance<IBus>().Publish(new CardCreated()
    {
        _id = cards._id,
        OwnerId = cards.OwnerId,
        Code = cards.Code,
        Name = cards.Name,
        Cost = cards.Cost,
        Discount = cards.Discount
    });
}

如果我运行此程序并单击“创建”按钮, 系统发送了消息错误

  

StructureMap异常代码:202没有为PluginFamily定义的默认实例NServiceBus.IBus,NServiceBus,Version = 2.6.0.1504,Culture = neutral,PublicKeyToken = 9fc386479f8a226c

1 个答案:

答案 0 :(得分:0)

您需要配置structuremap以使用具体实例。这是您设置总线配置的地方。一个例子就在这个question