单个ASP.net网站与多个实例和web.configs

我们有一个IIS服务器上运行的遗留ASP.net的网站,该站点由中央团队开发,并被多个客户使用.然而,每个客户都有自己的网站的aspx文件副本以及一个web.config文件.这导致问题,因为支持工程师对源aspx文件的副本的修改不会被折回到中心源,所以我们的代码库是分歧的.我们当前的文件夹结构如下所示:
OurApp / Source aspx&认的web.config
Customer1 / Source aspx& web.config
Customer2 / Source aspx& web.config
Customer3 / Source aspx& web.config
Customer4 / Source aspx& web.config

这是我想要更改的每个客户只需一个自定义的web.config文件,所有的客户共享一组通用的源文件.所以这样的东西:
OurApp / Source aspx&认的web.config
customer1表/ web.config
顾客2 / web.config
Customer3 / web.config
Customer4 / web.config

所以我的问题是,我该如何设置?我是ASP.NET和IIS的新手,因为我通常在家里使用PHP和apache,但我们在这里使用ASP.net和ISS.

代码控制被使用,我打算重新训练支持工程师,但是有什么办法避免有多个源aspx文件的副本?我讨厌那种重复!

解决方法

如果您在单个应用程序实例上死机,您可以在单个web.config中完成您之后使用自定义ConfigurationSection的操作.有关基础知识,请参阅:

> http://haacked.com/archive/2007/03/12/custom-configuration-sections-in-3-easy-steps.aspx
> http://msdn.microsoft.com/en-us/library/2tw134k3.aspx

示例XML可能是:

<YourCustomConfigSection>
   <Customers>
     <Customer Name="Customer1" SomeSetting="A" Another="1" />
     <Customer Name="Customer2" SomeSetting="B" Another="2" />
     <Customer Name="Customer3" SomeSetting="C" Another="3" />
   </Customers>
</YourCustomConfigSection>

现在在您的ConfigSection属性中,公开Name,SomeSetting和另一个.当访问或设置属性时,请使用条件(请求域或唯一标识客户的其他内容)来决定使用该属性.

通过正确的实现,应用程序开发人员不需要意识到幕后发生的情况.他们只是使用CustomSettings.Settings.someSetting,不用担心客户正在访问该应用程序.

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....