WebActivatorEx.ActivationManager类型上的错误引发异常....参数计数不匹配 [英] Error on type WebActivatorEx.ActivationManager threw an exception ....Parameter count mismatch
问题描述
安装Microsoft.Owin.*后出现此错误. 目标.Net Framework:4.5.2.网络激活器:2.2.0 我在另一个项目中具有相同的设置,而且看起来工作正常. 请帮助我调试或解决此问题.
I am getting this error after I installed Microsoft.Owin.*. Target .Net Framework:4.5.2. Web Activator: 2.2.0 I have the same setup in another project and that seems to work fine. Please help me debug or fix this.
到目前为止,我已经做过了吗:-
Have I have done so far:-
- 更新了所有Nuget软件包
- 已删除的obj文件夹内容
- 运行aspnet_compiler.exe -p C:\ source \ Application \ MyAPI -v any -errorstack.它确实给出了相同的错误,但是在我添加了WebMatrix.data之后就停止了.
完整错误详细信息:-
参数计数不匹配. 说明:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息.
Parameter count mismatch. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Stack Trace:
[TargetParameterCountException: Parameter count mismatch.]
System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture) +11403690
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +54
WebActivatorEx.BaseActivationMethodAttribute.InvokeMethod() +73
WebActivatorEx.ActivationManager.RunActivationMethods(Boolean designerMode)
+637
WebActivatorEx.ActivationManager.Run() +103
[InvalidOperationException: The pre-application start initialization method
Run on type WebActivatorEx.ActivationManager threw an exception with the
following error message: Parameter count mismatch..]
这是package.config:-
Here's the package.config :-
<package id="EntityFramework" version="6.1.3" targetFramework="net452" />
<package id="log4net" version="2.0.8" targetFramework="net452" />
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebHelpers" version="3.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebPages.Data" version="3.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebPages.WebData" version="3.2.3" targetFramework="net452" />
<package id="Microsoft.Owin" version="3.1.0" targetFramework="net452" />
<package id="Microsoft.Owin.Host.SystemWeb" version="3.1.0" targetFramework="net452" />
<package id="Microsoft.Owin.Security" version="3.1.0" targetFramework="net452" />
<package id="Microsoft.Owin.Security.OAuth" version="3.1.0" targetFramework="net452" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net452" />
<package id="Owin" version="1.0" targetFramework="net452" />
<package id="Swashbuckle" version="5.5.3" targetFramework="net452" />
<package id="Swashbuckle.Core" version="5.5.3" targetFramework="net452" />
<package id="WebActivatorEx" version="2.0" targetFramework="net452" />
推荐答案
我发现了问题.大摇大摆的另一个PreApplicationStartMethod引起了该问题. 在删除该行之后,一切开始起作用.
I found the issue. there was another PreApplicationStartMethod in swagger that was causing the issue. After I removed that line things started working.
这篇关于WebActivatorEx.ActivationManager类型上的错误引发异常....参数计数不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!