【发布时间】:2011-11-10 02:28:28
【问题描述】:
我正在尝试设置我的站点以使用 IIS7 MVC 3。
一开始 HttpContext.Current.User 为空,
然后我删除并添加了模型:Session、FormsAuthentication 在 system.webServer 模型中,现在 HttpContext.Current.User 不为空。
但是 HttpContext.Current.Profile 为空,我找不到解决方法。
如果我设置<modules runAllManagedModulesForAllRequests="true"> 它解决了问题,但由于性能问题我不想使用它。
<models> 中 Profile 的 FormsAuthentication 等效模型是什么?
有没有办法在不使用 runAllManagedModulesForAllRequests 的情况下获取配置文件?
Web.Config:
<system.webServer>
<handlers>
<remove name="ASP.NET MVC" />
<add name="ASP.NET MVC" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="classicMode,runtimeVersionv2.0,bitness64" />
<remove name="MvcHttpHandler" />
<add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler" />
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<remove name="WindowsAuthentication" />
<remove name="PassportAuthentication" />
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
<remove name="Session" />
<remove name="FormsAuthentication" />
<add name="Session" type="System.Web.SessionState.SessionStateModule" />
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
</modules>
【问题讨论】:
标签: asp.net-mvc iis-7 asp.net-mvc-routing