我在使用Unity 2的NServiceBus 3.0.0 beta 2預發佈對象構建器時收到以下錯誤。就我所能夠跟蹤的內容而言,成爲AutowireEnabledInjectionProperty構建器中的CommonObjectBuilder問題。使用NServiceBus解析Unity 2容器問題3對象構建器
配置爲NSB如下:
public class NServiceBusContainerExtension : UnityContainerExtension
{
protected override void Initialize()
{
var busConfig = NServiceBus.Configure.WithWeb()
.Log4Net()
.UnityBuilder(Container)
.MsmqTransport()
.IsTransactional(true)
.PurgeOnStartup(false)
.XmlSerializer()
.UnicastBus();
var bus = busConfig
.CreateBus()
.Start();
Container.RegisterType<IPublisher, NServiceBusPublisher>(new InjectionConstructor(bus));
}
}
錯誤:
[ArgumentNullException: Value cannot be null.
Parameter name: typeToCreate]
Microsoft.Practices.Unity.Utility.Guard.ArgumentNotNull(Object argumentValue, String argumentName) +55
NServiceBus.ObjectBuilder.Unity.AutowireEnabledInjectionProperty.AddPolicies(Type typeToCreate, Type implementationType, String name, IPolicyList policies) +87
Microsoft.Practices.Unity.UnityContainer.RegisterType(Type from, Type to, String name, LifetimeManager lifetimeManager, InjectionMember[] injectionMembers) +405
Microsoft.Practices.Unity.InjectedMembers.ConfigureInjectionFor(Type serviceType, Type implementationType, String name, InjectionMember[] injectionMembers) +66
Microsoft.Practices.Unity.InjectedMembers.ConfigureInjectionFor(Type typeToInject, InjectionMember[] injectionMembers) +22
NServiceBus.ObjectBuilder.Unity.ConfigureComponentAdapter.ConfigureProperty(String name, Object value) +325
NServiceBus.ObjectBuilder.Unity.UnityObjectBuilder.ConfigureProperty(Type concreteComponent, String property, Object value) +338
NServiceBus.ObjectBuilder.Common.ComponentConfig.NServiceBus.ObjectBuilder.IComponentConfig.ConfigureProperty(String name, Object value) +120
NServiceBus.ObjectBuilder.Common.ComponentConfig`1.NServiceBus.ObjectBuilder.IComponentConfig<T>.ConfigureProperty(Expression`1 property, Object value) +266
NServiceBus.ObjectBuilder.Common.Config.ConfigureCommon.With(Configure config, IContainer container) +633
NServiceBus.ConfigureUnityBuilder.UnityBuilder(Configure config, IUnityContainer container) +112
Udi,這是指消息類型? – BlackICE 2012-09-11 15:41:11
不,這是所有處理程序類型以及任何你想要注入這些處理程序的東西。 – 2012-09-11 16:55:52