好吧,这没什么大不了的,但它困扰着我,我不能放手.
因此,我将MVC 5.1与.NET 4.5.1和OWIN身份验证.因此,当您创建一个新的MVC5项目时,以下内容会自动添加到Web中.配置以摆脱forms authentication 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中的"FormsAuthenticationModule".配置.这是新版本asp的最新变化吗.net/iis还是我遗漏了什么?