使用IIS8.0 Express进行.NET Forms身份验证(vs2013) - 401.2 .:未经授权:由于服务器配置而导致登录失败 [英] .NET Forms Authentication using IIS8.0 Express (vs2013) - 401.2.: Unauthorized: Logon failed due to server configuration

查看:337
本文介绍了使用IIS8.0 Express进行.NET Forms身份验证(vs2013) - 401.2 .:未经授权:由于服务器配置而导致登录失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一点需要注意:我创建了一个带有个人用户帐户身份验证的Web应用程序,并添加了
,它的工作原理与预期完全相同。我不知道这个应用程序和以无身份验证开始时有什么不同。



我创建了一个新的webforms应用程序,无需身份验证,只是为了确保我的任何特定内容项目。按照本教程设置基本形式认证。当我加载我的项目时,我得到了下面的错误,而不是它重定向到我的Login.aspx页面。我的总体目标是创建一个基本上不允许用户访问任何页面的web应用程序,因为我在表单标签中指定了登录页面,我假设它使得匿名用户可访问的页面,所以每个人都可以登录。我觉得我的问题与IIS8.0 Express或我的项目设置有关。 'Windows Authentication = disabled''Anonymous Authentication = enabled'。

 < system.web> 
< authentication mode =Forms>
< loginUrl =〜/ Security / Login.aspxname =。ASPXFORMSAUTHtimeout =60>
< / forms>
< / authentication>
<授权>
<拒绝用户=? />
< / authorization>
< /system.web>

以下是我收到的错误:



'/'应用程序中的服务器错误。

访问被拒绝。



描述:访问提供此请求所需资源时发生错误。服务器可能未配置为访问所请求的URL。

错误消息401.2 .:未经授权:由于服务器配置而导致登录失败。验证您是否有权根据您提供的凭据以及Web服务器上启用的身份验证方法来查看此目录或页面。请联系Web服务器的管理员以获取更多帮助。

版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET Version:4.0.30319.34212

解决方案

遇到同样的问题,在我的web.config中发现:



< system.webServer>
<模块>
< remove name =FormsAuthentication/>
< / modules>



不太确定它是如何到达那里的,但删除它可以解决我的问题。



我想我会发布它以防万一它可以帮助其他人。


One thing to note: I created a Webapp w/ Individual User Accounts Authentication and added and it works exactly as expected. I wonder what is different between this app and when starting with No authentication.

I created a fresh webforms app w/ no Authentication just to make sure there was nothing specific in my project. Follow this tutorial to setup basic forms authentication. When I load my project I get the below error rather then it redirecting me to my Login.aspx page. My overall goal is to create a webapp that basically doesn't allow users to access any page unless they are signed in. Since I specify the Login page in the forms tag I am assuming it makes that an accessible page to anonymous users so everyone can login. I feel like my problem has to do with IIS8.0 Express or my project settings. 'Windows Authentication=disabled' 'Anonymous Authentication=enabled'.

<system.web>
  <authentication mode="Forms">
    <forms loginUrl="~/Security/Login.aspx" name=".ASPXFORMSAUTH" timeout="60">
    </forms>
  </authentication>
  <authorization>
    <deny users="?" />
  </authorization>
</system.web>

Below is the error I am getting:

Server Error in '/' Application.

Access is denied.

Description: An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL.

Error message 401.2.: Unauthorized: Logon failed due to server configuration. Verify that you have permission to view this directory or page based on the credentials you supplied and the authentication methods enabled on the Web server. Contact the Web server's administrator for additional assistance.

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34212

解决方案

Had the same issue and found this in my web.config:

<system.webServer> <modules> <remove name="FormsAuthentication" /> </modules> </system.webServer>

Not really sure how it got there but removing it fixed my problem.

I figured I would post it just in case it will help others.

这篇关于使用IIS8.0 Express进行.NET Forms身份验证(vs2013) - 401.2 .:未经授权:由于服务器配置而导致登录失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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