简体   繁体   English

如何在 IIS7 中设置虚拟目录/应用程序,使其不继承任何 web.config 设置?

[英]How can I set up a virtual directory/application in IIS7 so that it does not inherit any web.config settings?

I have an ASP.NET/IIS 7 web site that is working fine.我有一个运行良好的 ASP.NET/IIS 7 web 站点。 Now I want to add a classic ASP application to the site in a sub-folder.现在我想在站点的子文件夹中添加一个经典的 ASP 应用程序。 These are two completely separate applications.这是两个完全独立的应用程序。 One set of users will use the existing ASP.NET app - a different set of users will use the classic ASP app.一组用户将使用现有的 ASP.NET 应用程序 - 另一组用户将使用经典的 ASP 应用程序。 So I went ahead and created a new folder off of the root and copied the classic ASP app there.所以我继续在根目录下创建了一个新文件夹,并在那里复制了经典的 ASP 应用程序。 When I tried to visit the default page of the classic ASP app, I got redirected to the Login page (because of the web.config settings in my ASP.NET app).当我尝试访问经典 ASP 应用程序的默认页面时,我被重定向到登录页面(因为我的 ASP.NET 应用程序中的 web.config 设置)。 So I converted the folder for the classic ASP app to an application.因此,我将经典 ASP 应用程序的文件夹转换为应用程序。 That took care of the Login issue.这解决了登录问题。 But now I am getting errors regarding a Custom Role Provider that I am using in the ASP.NET app.但现在我收到有关我在 ASP.NET 应用程序中使用的自定义角色提供程序的错误。

I am guessing that somehow I need to set up my classic ASP app so that it doesn't inherit anything from the web.config of the main ASP.NET app.我猜想我需要以某种方式设置我的经典 ASP 应用程序,以便它不会从主 ASP.NET 应用程序的 web.config 继承任何内容。 Am I thinking about this correctly?我是否正确地考虑了这一点?

Does anyone have any other ideas about the best way to add a legacy ASP application to a ASP.NET site?关于将遗留 ASP 应用程序添加到 ASP.NET 站点的最佳方法,是否有人有任何其他想法?

Thanks, Corey谢谢,科里

Using clear should work, but if you should encounter more unwanted inherited settings, you could choose to disable inheritance of all web config settings to all application folders below the root folder by editing the web.config in the root directory and insert a location element with a inheritInChildApplications attribute set to false.使用 clear 应该可以工作,但如果您遇到更多不需要的继承设置,您可以选择禁用 inheritance 的所有 web 配置设置到根文件夹下的所有应用程序文件夹,方法是编辑 Z2567A5EC9705EB7AC2C2C984033E0618 在根目录中的所有应用程序文件夹将 inheritInChildApplications 属性设置为 false。

<?xml version="1.0"?>
<configuration>
    <location path="." inheritInChildApplications="false"> 
    <!--old web.config elements in root of site -->
    </location>
</configuration>

Does the classic ASP site have a web.config file?经典 ASP 站点是否有 web.config 文件? If not I think you should be able to add one.如果没有,我认为您应该可以添加一个。

Then, for each section in the web.config file where the classic ASP site has inherited some settings you should be able to add a <clear /> tag to remove anything defined further up the chain.然后,对于经典 ASP 站点继承了一些设置的 web.config 文件中的每个部分,您应该能够添加<clear />标记以删除链上进一步定义的任何内容。

So for example, to clear the custom role provider your classic ASP web.config should look something like this:例如,要清除自定义角色提供程序,您的经典 ASP web.config 应该如下所示:

<roleManager ...>
    <providers>
        <clear/>
    </providers>
</roleManager>

Hope this helps.希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将Web应用程序的单个虚拟目录设置为不继承web.config? - How do I set a single virtual directory of my web app to not inherit web.config? 如何使用IIS7在web.config中设置处理程序? - how to set a handler in web.config with IIS7? IIS 8.5 根站点 web.config 设置是否影响应用程序站点 web.config 设置? - Does IIS 8.5 Root site web.config settings affect the application site(s) web.config settings? 如何在iis7的web.config中注册处理程序 - How to register a handler in web.config for iis7 web.config 文件设置是否会覆盖 IIS 设置? - Does the web.config file settings override IIS settings? 如何在IIS7中获取虚拟应用程序或Virtual Dir的根目录? - How to get root directory of Virtual Application or Virtual Dir in IIS7? IIS7 强制 IE7 模式无响应 header 或 web.config 设置 - IIS7 Forcing IE7 Mode with no response header or web.config settings 在web.config中使用自定义错误设置时出现IIS7“单线”错误 - Getting IIS7 'one liner' error when using custom error settings in web.config 如何配置IIS,以便它使用每个文件夹的web.config - How to config IIS so that it uses web.config of each folder 我可以从Application_Start获取有关IIS7虚拟目录的信息吗? - Can I get information about the IIS7 virtual directory from Application_Start?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM