Iis TargetInvocationException-对象引用未设置为对象的实例。汽车制造商

Iis TargetInvocationException-对象引用未设置为对象的实例。汽车制造商,iis,asp.net-mvc-5,automapper,castle-windsor,Iis,Asp.net Mvc 5,Automapper,Castle Windsor,我经常在Windows事件查看器–应用程序错误日志中看到以下错误。这在Amazon Windows服务器上发生 Web应用程序位于ASP.net MVC 5中。我最近更新了解决方案的NuGet包,只是为了克服这个错误,但错误仍然存在 Event code: 3005 Event message: An unhandled exception has occurred. Event sequence: 22 Event occurrence: 9 Event detail code: 0

我经常在Windows事件查看器–应用程序错误日志中看到以下错误。这在Amazon Windows服务器上发生

Web应用程序位于ASP.net MVC 5中。我最近更新了解决方案的NuGet包,只是为了克服这个错误,但错误仍然存在

Event code: 3005 
Event message: An unhandled exception has occurred. 
Event sequence: 22 
Event occurrence: 9 
Event detail code: 0 

Application information: 
    Trust level: Full 
    Application Virtual Path: / 
    Application Path: WebApPath 
    Machine name: EC2AMAZ-TUK4T6L 

Process information: 
    Process ID: 9628 
    Process name: w3wp.exe 
    Account name: IIS APPPOOL\ AppPoolName 

Exception information: 
    Exception type: TargetInvocationException 
    Exception message: Exception has been thrown by the target of an invocation.
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeConstructorInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.FastCreateInstance(Type implType, Object[] arguments, ConstructorCandidate constructor)
   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType)

Object reference not set to an instance of an object.
   at AutoMapper.TypeMapFactory.<>c__DisplayClass3_0.<MapDestinationPropertyToSource>b__0(IMemberConfiguration _)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at AutoMapper.TypeMapFactory.CreateTypeMap(Type sourceType, Type destinationType, IProfileConfiguration options, MemberList memberList)
   at AutoMapper.ConfigurationStore.<>c__DisplayClass80_0.<CreateTypeMap>b__0(TypePair tp)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at AutoMapper.ConfigurationStore.CreateMap[TSource,TDestination](String profileName, MemberList memberList)
   at AP.Web.Services.Services.CustInfoService..ctor(ICustInfoRepository repository)

Thread information: 
    Thread ID: 22 
    Thread account name: IIS APPPOOL\ AppPoolName 
    Is impersonating: False 
    Stack trace:    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeConstructorInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.FastCreateInstance(Type implType, Object[] arguments, ConstructorCandidate constructor)
   at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType)


Custom event details:
事件代码:3005
事件消息:发生未处理的异常。
事件顺序:22
事件发生率:9
事件详细信息代码:0
申请资料:
信任级别:完全信任
应用程序虚拟路径:/
应用程序路径:WebApPath
机器名称:EC2AMAZ-TUK4T6L
过程信息:
进程ID:9628
进程名称:w3wp.exe
帐户名称:IIS APPPOOL\AppPoolName
例外信息:
异常类型:TargetInvocationException
异常消息:调用目标已引发异常。
位于System.RuntimeMethodHandle.InvokeMethod(对象目标、对象[]参数、签名符号、布尔构造函数)
在System.Reflection.RuntimeConstructorInfo.Invoke(对象obj、BindingFlags invokeAttr、绑定器Binder、对象[]参数、CultureInfo区域性)
位于Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.FastCreateInstance(类型impltType,对象[]参数,构造函数Candidate构造函数)
位于Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate构造函数,对象[]参数,类型implType)
对象引用未设置为对象的实例。
在AutoMapper.TypeMapFactory.c__显示Class3_0.b__0(IMemberConfiguration)
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source,Func`2谓词)
在AutoMapper.TypeMapFactory.CreateTypeMap(类型sourceType、类型destinationType、IProfileConfiguration选项、成员列表MemberList)
在AutoMapper.ConfigurationStore.c__;u显示Class80_0.b_u0(类型对tp)
位于System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey,Func`2 valueFactory)
在AutoMapper.ConfigurationStore.CreateMap[TSource,TDestination](String profileName,MemberList MemberList)
位于AP.Web.Services.Services.CustInfoService..ctor(ICustInfo存储库)
线程信息:
线程ID:22
线程帐户名称:IIS APPPOOL\AppPoolName
是模仿:假
堆栈跟踪:位于System.RuntimeMethodHandle.InvokeMethod(对象目标、对象[]参数、签名符号、布尔构造函数)
在System.Reflection.RuntimeConstructorInfo.Invoke(对象obj、BindingFlags invokeAttr、绑定器Binder、对象[]参数、CultureInfo区域性)
位于Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.FastCreateInstance(类型impltType,对象[]参数,构造函数Candidate构造函数)
位于Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate构造函数,对象[]参数,类型implType)
自定义事件详细信息:
无法确定出现此错误的原因。非常感谢你的帮助

谢谢,


Raj.

什么是AutoMapper版本?尝试升级该.AutoMapper版本:4.1.1.0。我将尝试感谢@lucianbargaoanuupdated Auto-mapper,因为它使我的代码发生了很多变化。例如,AutoMapper的更新版本不支持container.Register(Component.For().Instance(mapper.Engine));而且更新版本的AuthoMapper不包含CreateMap等的定义。我的代码已经过测试,现在已经在实时环境中运行。问题是在将主机服务器更改为Amazon Windows server后开始的。然后您必须在CreateMap调用周围添加一个锁。您能解释一下如何操作吗?这是我的CreateMap调用私有只读IDocumentTypeMstRepository存储库;公共文档类型MST服务(IDocumentTypeMstRepository存储库){u repository=repository;Mapper.CreateMap().ReverseMap();}