Asp.net MVC误差配置管理模块 [英] Asp.net MVC error with configured managed modules

查看:110
本文介绍了Asp.net MVC误差配置管理模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义的认证的HttpModule 是pretty海峡前进。但我想它对于管理的要求只运行(而不是静态的)。

Asp.net MVC自动添加配置部分IIS7 Web服务器:

 < system.webServer>
   <验证validateIntegratedModeConfiguration =FALSE/>
   <模块runAllManagedModulesForAllRequests =真正的>
      <清除NAME =ScriptModule/>
      <清除NAME =UrlRoutingModule/>
      <添加名称=ScriptModule
           preCondition =managedHandler
           键入=System.Web.Handlers.ScriptModule,.../>
      <添加名称=UrlRoutingModule
           键入=System.Web.Routing.UrlRoutingModule,.../>
   < /模块>
   <&处理GT;
      ...
   < /处理器>
< /system.webServer>

在添加自己的模块,我还设置了 preCondition =managedHandler,但因为有 runAllManagedModulesForAllRequests =真正的在父<模块> 元素我的 preCondition 被设计忽略(如我读了MSDN)。

当我尝试虽然设置:

 <模块runAllManagedModulesForAllRequests =false的>

我得到一个错误。

还有什么(这另一个模块)我在的web.config设置此设置工作:

 <模块runAllManagedModulesForAllRequests =false的>


解决方案

我想你已经得到了错误消息,因为您的应用程序依靠其他管理模块(会议)和该模块上配置为仅适用于请求运行托管处理程序(runAllManagedModulesForAllRequests =假)。

您可以尝试以下设置会话模块重新配置,为所有请求运行

 <模块>
<清除NAME =会话/>
<添加名称=会话TYPE =System.Web.SessionState.SessionStateModulepreCondition =/>
< /模块>

I have a custom authentication HttpModule that is pretty strait forward. But I want it to run only for managed requests (and not for static ones).

Asp.net MVC automatically adds configuration section for IIS7 web server:

<system.webServer>
   <validation validateIntegratedModeConfiguration="false" />
   <modules runAllManagedModulesForAllRequests="true">
      <remove name="ScriptModule" />
      <remove name="UrlRoutingModule" />
      <add name="ScriptModule"
           preCondition="managedHandler"
           type="System.Web.Handlers.ScriptModule,..." />
      <add name="UrlRoutingModule"
           type="System.Web.Routing.UrlRoutingModule,..." />
   </modules>
   <handlers>
      ...
   </handlers>
</system.webServer>

When I add my own module I also set its preCondition="managedHandler", but since there's runAllManagedModulesForAllRequests="true" on parent <module> element my preCondition is ignored by design (as I read on MSDN).

When I try to set though:

<modules runAllManagedModulesForAllRequests="false">

I get an error.

What else (which other module) do I have to set in web.config to make this setting work:

<modules runAllManagedModulesForAllRequests="false">

解决方案

I think you’ve got the error message because your application was relying on some other managed module (Session) and that module was configured to run only for requests to managed handler (runAllManagedModulesForAllRequests="false").

You can try the following setting to Re-configure the Session module to run for all requests

<modules>
<remove name="Session" />
<add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition="" />
</modules>

这篇关于Asp.net MVC误差配置管理模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆