IIS 7如何preserve网站的子文件夹验证settigns [英] IIS 7 how to preserve website subfolder Authentication settigns

查看:657
本文介绍了IIS 7如何preserve网站的子文件夹验证settigns的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在IIS中,您可以设置使用的功能视图文件夹级别设置(见截图)。我想禁用匿名身份验证为我的网站的几个子文件并保存到源代码控制这些设置。我想知道哪里IIS保存这些设置。他们不是在web.config中网站或内部的子文件夹中的web.config。反正我有可以与源$ C ​​$ C保存IIS设置还是必须与每个新鲜deployement执行这些任务?

In IIS you can set folder-level settings using the Features view (see screenshot). I want to disable Anonymous authentication for several subfolders of my website and save those settings to source control. I want to know where does IIS save these settings. They are not in the website web.config or the web.config inside subfolders. Is there anyway I can save the IIS settings with the source code or do I have to perform these tasks with each fresh deployement?

推荐答案

以下内容添加到你的根的web.config 为要保护的每个文件夹:

Add the following to your root web.config for each folder you want to secure:

<location path="secure_folder">
    <system.webServer>
        <security>
            <authentication>
                <anonymousAuthentication enabled="false" />
                <basicAuthentication enabled="true" />
            </authentication>
        </security>
    </system.webServer>
</location>

以上假设您正在使用基本身份验证。

The above assumes that you're using Basic Authentication.

另外,在每组子文件夹中的的web.config 与pretty差不多(只是没有&LT固定; 标签:

Alternatively create a web.config in each sub folder to be secured with pretty much the same (except without the <location> tag:

<system.webServer>
    <security>
        <authentication>
            <anonymousAuthentication enabled="false" />
            <basicAuthentication enabled="true" />
        </authentication>
    </security>
</system.webServer>

如果收到一个错误,如:

If receive an error such as:

在执行此操作时出错。

详细内容:

文件名:\\ \\ D:\\网站\\ play1 \\ WWW \\ web.config中

Filename: \?\d:\sites\play1\www\web.config

行号:15

错误:这部分配置不能在这个路径中使用。这个
  当部分在一父级别锁定发生。锁定是
  或者通过默认设置的(overrideModeDefault =拒绝),或通过一个明确设置
  包含overrideMode位置标记=拒绝或遗产
  有的allowOverride =false的。

Error: This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".

然后,它意味着&LT的配置设置; anonymousAuthentication&GT; &LT; basicAuthentication&GT; 一直没委派读/写权限。

Then it means that the configuration settings for <anonymousAuthentication> and <basicAuthentication> haven't been delegated Read/Write permissions.

您可以通过启动IIS管理器,打开功能委派经理调整如下:

You can adjust this by launching IIS Manager and opening the Feature Delegation manager:

当你这样做,你将看到一个可以控制和功能的列表其代表团状态:

When you do this you'll see a list of features that can be controlled and their delegation state:

右键单击身份验证 - 匿名并选择读/写。执行相同的身份验证 - 基本

Right click on Authentication - Anonymous and select Read/Write. Do the same for Authentication - Basic.

此功能委派设置将整个服务器上所有网站的全局应用,但它有可能微调此使用自定义站点委派特定网站。

This feature delegation setting will be applied globally across all sites on the server, however it is possible to fine tune this to specific sites using Custom Site Delegation.

您可以阅读更多有关IIS 7.x版/ 8.0功能委派这里:

You can read more about IIS 7.x/8.0 Feature Delegation here:

<一个href=\"http://www.iis.net/learn/manage/managing-your-configuration-settings/an-overview-of-feature-delegation-in-iis\" rel=\"nofollow\">http://www.iis.net/learn/manage/managing-your-configuration-settings/an-overview-of-feature-delegation-in-iis

这篇关于IIS 7如何preserve网站的子文件夹验证settigns的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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