好的,这没什么大不了的,但是它困扰着我,我无法放手。
所以我正在使用带有.NET 4.5.1和OWIN身份验证的MVC 5.1。因此,当您创建一个新的MVC 5项目时,以下内容将自动添加到Web.config中,以摆脱表单身份验证http模块的使用,因为在使用OWIN中间件时不再需要它:
<system.webServer>
<modules>
<remove name="FormsAuthenticationModule" />
</modules>
</system.webServer>
现在,由于我们要删除该模块,这意味着它是先前添加的,因此这是在以下位置注册此http模块的条目C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config
:
<httpModules>
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
</httpModules>
这是C:\Windows\System32\inetsrv\config\applicationHost.config
IIS 8.5中的条目,它告诉我的应用程序使用该模块:
<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中的最新更改吗?
您是对的-这是模板中的错字。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句