我如何为两个网络应用程序使用相同的 web.config 文件?

发布于 2024-09-13 16:55:28 字数 212 浏览 2 评论 0原文

我有两个网络应用程序。他们在服务器中的文件夹层次结构就是这样。 第一个是:.../firstapplitaion 第二个是:.../firstapplication/secondapplication/Default.aspx

首先我可以仅使用firstapplication的web.config文件来运行它们吗?第二个应用程序的网络配置没有任何特殊的东西。

感谢您的帮助..

I have two web application. Their folder hierarchy in server is like that.
first one is : .../firstapplitaion
second is : .../firstapplication/secondapplication/Default.aspx

At first can i run them with just firstapplication's web.config file? secondapplication's web config hasnt any special things.

Thanks for your helps..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

过期情话 2024-09-20 16:55:28

一种方法是让 web.config 文件中的一个部分指向适当的文件,如下

<configuration>
   <appSettings file="C:\MyCommonFolder\MyCommonAppSettings.config">
   </appSettings>
</configuration>

希望有帮助

One way would be to have a section in your web.config files point to an appropriate file, like this

<configuration>
   <appSettings file="C:\MyCommonFolder\MyCommonAppSettings.config">
   </appSettings>
</configuration>

Hope that helps

够运 2024-09-20 16:55:28

如果第二个应用程序的 web.config 文件相同,为什么还要将它们作为单独的应用程序运行呢?为什么不让它们成为一个使用相同 web.config 的应用程序呢?或者您是否试图将它们分成单独的应用程序池?

我在类似情况下所做的就是让每个站点都包含自己单独的 web.config,但将所有共享部分移至我的 Machine.config 中。对我来说,它位于 C:\WINDOWS\Microsoft.NET\Framework\vX.X.XXX\Config 文件夹中(我建议先备份它)。由于配置文件的工作方式,您可以将设置放入 machine.config 中,您的网站将继承这些设置。因此,将任何共享设置放在那里,并使用非常独特的名称,您就应该完成设置了。

If the second app's web.config file is the same why bother to even run them as seperate apps? Why not just make them one app that uses the same web.config? Or were you trying to split them into seperate app pools?

What I have done in a similar situation was to have each site contain it's own seperate web.config but to move all of the shared pieces into my Machine.config. For me it's locatd in the C:\WINDOWS\Microsoft.NET\Framework\vX.X.XXX\Config folder (I would suggest backig it up first). Because of the way the config files work you can put settings in your machine.config and your websites will inherit these settigs. So put any shared settings there, with very unique names, and you should be set.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文