【发布时间】:2014-03-06 08:15:29
【问题描述】:
好吧,这没什么大不了的,但它困扰着我,我不能放手。
所以我将 MVC 5.1 与 .NET 4.5.1 和 OWIN 身份验证一起使用。所以当你创建一个新的 MVC 5 项目时,以下内容会自动添加到 Web.config 以摆脱表单身份验证 http 模块,因为在使用 OWIN 中间件时不再需要它:
<system.webServer>
<modules>
<remove name="FormsAuthenticationModule" />
</modules>
</system.webServer>
现在我们要移除这个模块,这意味着它是之前添加的,所以这里是在C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config中注册这个http模块的条目:
<httpModules>
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
</httpModules>
这里是 IIS 8.5 的 C:\Windows\System32\inetsrv\config\applicationHost.config 中的条目,它告诉我的应用程序使用该模块:
<system.webServer>
<modules>
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" preCondition="managedHandler" />
</modules>
</system.webServer>
因此,在应用程序级别自动添加到我的 Web 配置的内容具有名称属性“FormsAuthenticationModule”,而两个服务器级别/asp.net 级别配置文件中的条目使用名称属性“FormsAuthentication”。那么这里发生了什么?在我看来,模块不会被删除,因为 name 属性不匹配。我只是认为这是一个错字,但在网上搜索后,每个人似乎都在应用程序 web.config 中使用“FormsAuthenticationModule”。这是最新版本的 asp.net / iis 的最新变化还是我遗漏了什么?
【问题讨论】:
标签: asp.net forms-authentication asp.net-mvc-5 iis-8 owin