关于集成的管线模式卡西尼错误
问题描述:
此操作需要IIS版本7.5或更高版本运行在 集成的管线模式。
随时尝试访问我的WebApi页面时会出现。装饰的方法从未被击中。我知道卡西尼不允许集成模式。但是,我使用的代码与使用Cassini的代码库中的其他项目非常相似,我们不会收到此错误。
我不知道我在用什么,需要集成管道模式。我的猜测是global.asax中的问题导致了这个问题。我正在使用SimpleInjector。
我已经煮了我的Global.asax到这一点:
public class WebApiApplication : SimpleInjectorApiApplication<GenericExceptionPolicy>
{
protected override Assembly GetVersionAssembly()
{
return Assembly.GetExecutingAssembly();
}
protected override void RegisterServices()
{
base.RegisterServices();
Container.Register<IEntityCache, EntityCache>();
Container.Register<ICacheProvider, HttpCacheProvider>();
Container.Verify();
}
protected override void OnApplicationStarted()
{
base.OnApplicationStarted();
WebApiConfig.Register(RouteTable.Routes);
}
}
我的控制器:
public class GenericController : ApiController
{
[HttpPost]
public HttpResponseMessage Get(/*PocoObjectName item*/)
{
throw new NotImplementedException();
}
}
而web.config中包含此相关的部分:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
所有这个代码存在于其他项目中,因为它是..所以我在这里的问题是完全损失。该问题仅发生在卡西尼(IIS Express运行代码的罚款)。其他项目正在使用卡西尼没有这个错误。
答
我更新了Microsoft.AspNet.WebApi.WebHost
。在包管理器控制台的NuGet我去的:
Install-Package Microsoft.AspNet.WebApi.WebHost -Version 5.1.0.0
到
Install-Package Microsoft.AspNet.WebApi.WebHost -Version 5.1.2.0
和问题走了。