私はMVC4webapiコントローラーを持っています。パラメーターのないコンストラクターはありません。したがって、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 module automatically without having to add anything to the config file.
明らかに、windsordiは彼のHttpModuleを登録できません。追加しようとしました
<system.web>
<httpModules>
<add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
</httpModules>
</system.web>
私のapp.configでは、運がありません。WebActivatorを試して、PreApplicationStartメソッドも使用できませんでした。自己ホスト型webapiアプリのhttpModuleを追加する方法はありますか?