我如何为两个网络应用程序使用相同的 web.config 文件?
我有两个网络应用程序。他们在服务器中的文件夹层次结构就是这样。 第一个是:.../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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一种方法是让 web.config 文件中的一个部分指向适当的文件,如下
希望有帮助
One way would be to have a section in your web.config files point to an appropriate file, like this
Hope that helps
如果第二个应用程序的 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.