小编bra*_*ost的帖子

当webApi与HttpSelfHostServer一起运行时,有没有办法添加httpModule?

我有一个MVC4 webapi控制器.它没有无参数构造函数.所以,我使用Windsor依赖解析器,在System.Web.Http.WebHost下工作时一切正常.但是,当我尝试使用HttpSelfHostServer时,我收到异常消息:

Looks like you forgot to register the http module Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule To fix this add <add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" /> to the <httpModules> section on your web.config. If you plan running on IIS in Integrated Pipeline mode, you also need to add the module to the <modules> section under <system.webServer>. Alternatively make sure you have Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 assembly in your GAC (it is installed by ASP.NET MVC3 or WebMatrix) and Windsor will be able to register the …

dependency-injection castle-windsor self-hosting asp.net-mvc-4 asp.net-web-api

3
推荐指数
1
解决办法
1352
查看次数