【发布时间】:2015-07-01 07:04:09
【问题描述】:
我有一个基本的 Visual Studio 项目,一个站点中有 2 个文件夹,一个名为“pub”的文件夹应该是公开可用的,一个名为“auth”的文件夹需要您登录才能查看内容。我在管理它的 web.config 中有 2 个位置规则。 我还使用了一个基本的身份验证模块(http://www.asp.net/web-api/overview/security/basic-authentication),它被添加到 IIS 中的模块中并注册了
在 VS 中,当我使用 IISExpress 进行调试时,一切都按预期工作,'pub' 让我没有问题,并且 auth 使用'basic' auth 提示我输入凭据。但是当我发布(通过VS,在更新之前删除所有文件)站点到IIS 7.5时,每个文件夹都需要身份验证,这是错误的。
现在,如果是导致问题的 BasicAuthModule,那么如何在 IISExpress 中使用基本身份验证提示输入凭据,但如果不是模块,那么 IISExpress 调试安装和我的服务器之间有什么不同?
实际上并没有太多要显示的代码,但这是我的 web.config 以及我们正在使用的代码:
-system.webServer-
-modules-
-add name="BasicAuthHttpModule" type="WebHostBasicAuth.BasicAuthHttpModule" -
-/modules-
-/system.webServer-
-system.web-
-httpRuntime targetFramework="4.5" -
-authentication mode="Windows" -
-/system.web-
-location path="~/services/public"-
-system.web-
-authorization-
-allow users="*"-
-/authorization-
-/system.web-
-/location-
-location path="~/services/auth"-
-system.web-
-authorization-
-deny users="?"-
-/authorization-
-/system.web-
-/location-
【问题讨论】:
标签: c# asp.net authentication iis visual-studio-2012