c# - WebActivatorEx causing ArgumentException on Application Start -
i keep getting following argumentexception when trying visit page after installing webactivatorex nuget package.
server error in '/pharmadotnet/ux' application. type pharma.mvc.startup doesn't have static method named configuration description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.argumentexception: type pharma.mvc.startup doesn't have static method named configuration source error: unhandled exception generated during execution of current web request. information regarding origin , location of exception can identified using exception stack trace below. stack trace: [argumentexception: type pharma.mvc.startup doesn't have static method named configuration] webactivatorex.baseactivationmethodattribute.invokemethod() +166 webactivatorex.activationmanager.runactivationmethods(boolean designermode) +445 webactivatorex.activationmanager.run() +105 [invalidoperationexception: pre-application start initialization method run on type webactivatorex.activationmanager threw exception following error message: type pharma.mvc.startup doesn't have static method named configuration.] system.web.compilation.buildmanager.invokeprestartinitmethodscore(icollection`1 methods, func`1 sethostingenvironmentcultures) +12981643 system.web.compilation.buildmanager.invokeprestartinitmethods(icollection`1 methods) +12981352 system.web.compilation.buildmanager.callprestartinitmethods(string prestartinitlistpath, boolean& isrefassemblyloaded) +280 system.web.compilation.buildmanager.executepreappstart() +172 system.web.hosting.hostingenvironment.initialize(applicationmanager appmanager, iapplicationhost apphost, iconfigmappathfactory configmappathfactory, hostingenvironmentparameters hostingparameters, policylevel policylevel, exception appdomaincreationexception) +1151 [httpexception (0x80004005): pre-application start initialization method run on type webactivatorex.activationmanager threw exception following error message: type pharma.mvc.startup doesn't have static method named configuration.] system.web.httpruntime.firstrequestinit(httpcontext context) +12980692 system.web.httpruntime.ensurefirstrequestinit(httpcontext context) +159 system.web.httpruntime.processrequestnotificationprivate(iis7workerrequest wr, httpcontext context) +12820285 version information: microsoft .net framework version:4.0.30319; asp.net version:4.0.30319.34249
if remove webactivatorex package works again need webactivatorex in order use di.
i can't find online suggest issue might be. i've tried creating startup
class in pharma.mvc
namespace static method called configuration
not appear fix issue.
also, before installed package there no pharma.mvc
namespace nor there startup
class. i'm confused why happening.
i'm targeting asp.net 4.5.1 framework when build application have noticed in stack trace @ bottom reads microsoft .net 4 framework version:4.0.30319
, i'm not sure if correct or not.
i using owin middleware webapi , therefore needed startup class following assembly attribute [assembly: owinstartup(typeof(startup))]
i use swagger interface webapi , installed via nuget package. install added swaggerconfig class following assembly attribute [assembly: preapplicationstartmethod(typeof(swaggerconfig), "register")]
the assembly attribute causing exception when starting webapi. removed assembly attribute swaggerconfig class , working fine.
Comments
Post a Comment