惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
Kaspersky official blog
Martin Fowler
Martin Fowler
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
V
Visual Studio Blog
博客园_首页
Engineering at Meta
Engineering at Meta
The Cloudflare Blog
MongoDB | Blog
MongoDB | Blog
Blog — PlanetScale
Blog — PlanetScale
T
The Blog of Author Tim Ferriss
雷峰网
雷峰网
D
Docker
博客园 - 司徒正美
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
U
Unit 42
J
Java Code Geeks
A
About on SuperTechFans
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security Affairs
I
Intezer
Cisco Talos Blog
Cisco Talos Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
B
Blog RSS Feed
P
Privacy & Cybersecurity Law Blog
T
Tenable Blog
T
Threatpost
H
Hacker News: Front Page
G
Google Developers Blog
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
L
Lohrmann on Cybersecurity
大猫的无限游戏
大猫的无限游戏
Google DeepMind News
Google DeepMind News
A
Arctic Wolf
S
Secure Thoughts
GbyAI
GbyAI
NISL@THU
NISL@THU
S
Security @ Cisco Blogs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Webroot Blog
Webroot Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
O
OpenAI News
Spread Privacy
Spread Privacy
Application and Cybersecurity Blog
Application and Cybersecurity Blog

博客园 - 酷咖啡

收藏:精妙SQL语句 用户中心 - 博客园 博文阅读密码验证 - 博客园 web2.0配色收集 也谈C#中的反射用法 C#访问修饰符 C#中相等的判断 [LoveCherry]一步一步学Linq to sql系列文章 [LoveCherry]无废话C#设计模式系列文章 .Net常用资源收集 Some word in English about Company website Reflection,Regular Expression,Threading,IO,AppDomain,Web Service/Remoting Service,ORM 收藏:笔记本得理器型号规格 刚刚用上了百度Hi 自定义可绑定数据的业务对象实体和强类型 Asp.net 2.0 网站首页生成静态的方法 数据库设计的5种常见关系 [收集]visual studio文件扩展名 说说最近的工作
如何让虚拟目录里面的webconfig不继承网站[转]
酷咖啡 · 2008-03-31 · via 博客园 - 酷咖啡

今天要部署一个网站和一个和网站相关的webservices接口,我把网站部署后,就把WEB接口作为它下面的一个虚拟目录来处理了,这样他们可以共享一个域名.他们各个都有一个webconfig配置文件,部署后发现网站正常,可是WEB接口却报错,说配置文件出了问题,仔细检查发现WEB接口用的是网站的配置文件,一下子没招了.

后来在网上一查,发现利用配置文件的配置节可以让它不继承父目录的配置文件,如下

<location path="." allowOverride="false" inheritInChildApplications="false"> </location>

把它加在父目录的<system.web>节外面即可,测试一下果然如此,甚喜,虽记之以备忘,同时也于大伙共享!

下面是更好的一个:

虚拟目录中的web.config继承了主目录中的web.config出现问题是由于根目录中的web.config添加了httphandler、 httpmodule 引起的。
解决办法:将 httphandler httpmodule的声明添加到location中。
如下所示:
<location path="." allowOverride="true" inheritInChildApplications="false">
<system.web>
<httpModules>
<add name="UrlRewriteModule"
type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
</httpModules>
</system.web>
</location>

path 不用说指定的是一个目录
allowOverride 指是否可以将这个重写
inheritInChildApplications 指是否被子级应用程序继承