How do you prevent the IIS default site web.config file being inherited by virtual directories?

前端 未结 3 1247
暖寄归人
暖寄归人 2021-02-02 14:24

I have the following code in a web.config file of the default IIS site.


    

        
3条回答
  •  太阳男子
    2021-02-02 15:01

    I've found the answer. Wrap the HttpModule section in location tags and set the inheritInChildApplications attribute to false.

    
      
        
          
        
      
    
    

    Now any virtual directories will not inherit the settings in this location section.

    @GateKiller This isn't another website, its a virtual directory so inheritance does occur.

    @petrich I've had hit and miss results using . I have to remember to add it to every virtual directory which is a pain.

提交回复
热议问题