我部署了一个使用Windows授权的Web应用程序。它工作正常,但当我在本地复制它时,我收到错误401.2(访问被拒绝)。我的用户已获得授权,可以访问已部署的版本,但不能访问本地版本。我需要一个有效的本地版本,因为在本地计算机上进行开发并部署而不是在服务器计算机上进行开发是一种更好的做法。
下面的Web.config摘录......
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<!--Connection strings here-->
</connectionStrings>
<system.web>
<compilation debug="true">
<assemblies>
<!--Assemblies here-->
</assemblies>
</compilation>
<authentication mode="Windows"/>
<identity impersonate="false"/>
<customErrors mode="Off"/>
<authorization>
<deny users="?"/>
</authorization>
<roleManager enabled="true" cacheRolesInCookie="true" defaultProvider="AspNetWindowsTokenRoleProvider"/>
</system.web>
<system.webServer>
<directoryBrowse enabled="true"/>
<defaultDocument>
<files>
<add value="Home.aspx"/>
</files>
</defaultDocument>
<httpRedirect enabled="false" destination="http://report.com/"/>
</system.webServer>
<location path="Functions/AdminConfiguration.aspx">
<system.web>
<authorization>
<allow roles="DataTeam"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
<location path="Functions/BusinessAccountReportConfig.aspx">
<system.web>
<authorization>
<allow roles="DataTeam"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
<location path="Functions/BusinessAccountRebateConfiguration.aspx">
<system.web>
<authorization>
<allow roles="DataTeam"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
<location path="Functions/Watchlists.aspx">
<system.web>
<authorization>
<allow roles="DataTeam,Finance"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
<location path="Functions/MappingTablesConfiguration.aspx">
<system.web>
<authorization>
<allow roles="DataTeam"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
<location path="Functions/Transactions.aspx">
<system.web>
<authorization>
<allow roles="DataTeam"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
<location path="Functions/Administration.aspx">
<system.web>
<authorization>
<allow roles="DataTeam"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
<location path="Functions/IPSReports.aspx">
<system.web>
<authorization>
<allow roles="DataTeam"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
<appSettings>
</appSettings>
</configuration>
答案 0 :(得分:0)
您需要在Visual Studio中启用Windows身份验证。为此,请确保您的项目在解决方案资源管理器中处于活动状态,然后单击属性。您需要启用Windows身份验证,然后禁用匿名身份验证。这应该做到这一点。