重复代码和重复代码的最佳实践虚拟目录
我有一个专用服务器[win2008 & iis7] 将有 50 个站点运行相同的 .Net 电子商务应用程序。 最好对每个站点的所有相同文件夹使用虚拟目录吗?它将节省磁盘空间和将使代码更新变得更加容易。
每个虚拟目录是否仍知道从正确的 web.config 获取其连接字符串和区域性?
感谢您的建议!
I have a dedicated server [win2008 & iis7] that is going to have 50 sites running the same .Net e-commerce application.
Would it be best to use virtual directories for all the folders that are identical for each site? It would save on disk space & would make code updates much easier.
Would each virtual directory still know to get it's connection string and culture from the right web.config?
Thanks for your advice!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可以按照您的描述设置配置。
另一种方法是使用虚拟路径提供程序。这种相对鲜为人知的技术允许您跨 ASP.NET 站点共享代码或任何其他内容,但仍然保留每个站点单独的可测试性。它还允许您在所有这些网站上共享内容,具体取决于您的实施方式,但仍可根据需要一起或独立发布它们。就磁盘空间而言,您可以从单个位置甚至文件共享(仅限高可用性)或数据库提供内容。
如果您在网络上搜索,就会发现很多这样的示例,但这里有一篇文章。
It is possible to set up a configuration as you describe.
An alternative is to use a virtual path provider. This relatively little known technique allows you to share code or any other content across ASP.NET sites, yet still retains testability of each site alone. It will also allow you, depending on how you implement it, to share content across all these sites yet still release them together or independently as needed. As far as disk space is concerned, you can serve the content from a single location or even a file share (high availability only) or a database.
There are lots of examples of this if you search the web, but here is one article.