0

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

StructureMap 异常代码:202 没有为 PluginFamily NServiceBus.IBus、NServiceBus、Version=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 定义默认实例

4

1 回答 1

0

您需要配置结构图以使用具体实例。这是您设置总线配置的地方。这个问题有一个例子

于 2013-02-25T03:55:39.970 回答