简体   繁体   English

网站根目录中的Web.config干扰了其他应用程序Web.config(IIS)

[英]Web.config in website root is interfering with additional application Web.config (IIS)

I have 2 separate ASP.NET web applications setup in IIS that need to interact as one. 我在IIS中有2个单独的ASP.NET Web应用程序设置,需要作为一个交互。

I created a New Website in IIS. 我在IIS中创建了一个新网站。 I put the files for App1 in the root directory of the Website. 我将App1的文件放在网站的根目录中。 I then created a directory called Admin and added App2 files. 然后,我创建了一个名为Admin的目录并添加了App2文件。 I right clicked the Admin directory in IIS and clicked Convert to Web Application. 我右键单击IIS中的Admin目录,然后单击“转换为Web应用程序”。

It seems like the web.config in the root (App1) is interfering with the web.config within App2. 似乎根(App1)中的web.config干扰了App2中的web.config。

Is there a better way to set this up? 有没有更好的方法来进行设置? Should both be their own applications within an empty Website? 两者都应该是在空网站中的各自应用程序吗? I kind of wanted to avoid this since I want the effect of www.mydomain.com for the main app and then www.mydomain.com/Admin for App2. 我有点想避免这种情况,因为我希望对主应用程序使用www.mydomain.com,对App2使用www.mydomain.com/Admin。

Your Admin website will inherit settings from parent (and therefore the root website) web.config. 您的管理网站将继承父网站(因此是根网站)web.config的设置。

You can explicitly override settings in the Admin web.config. 您可以在Admin web.config中显式覆盖设置。

Also for configuration sections that have collections, you can often use clear to clear settings from the parent, eg: 同样对于具有集合的配置节,您通常可以使用clear清除父项中的设置,例如:

<connectionStrings>
  <clear/>
  <add ... />
</connectionStrings>

<appSettings>
  <clear/>
  <add ... />
</appSettings>

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM