所以最终我必须提出一种基于框架的方法?已经有这种效果了吗?或者我该怎么做?我将面临哪些挑战? 解决方案 Web 配置文件允许您创建自定义程序集特定的配置部分.查看 http://msdn.microsoft.com/en-us/library/2tw134k3.aspx 详情此外,您可以指定其他文件作为配置文件,以供 .net 中的配置解析器使用和解析您可以使用配置文件中的配置源选项来执行此操作:例如在 App.config/Web.config 中<system.serviceModel><services configSource="Services.config" ></服务></system.serviceModel></配置>创建一个名为 Services.config 的文件,并在其中:<服务名称="SomeNameSpace.MyService"behaviorConfiguration="MyServiceBehaviour"><基地址><add baseAddress="http://localhost:1234/service"/></baseAddresses></host><端点地址="net.tcp://localhost:8000/service"绑定=netTcpBinding"bindingConfiguration="Binding1"contract="SomeNameSpace.IService"/></服务></服务>My primary assembly is a web application. It uses spring.net framework to load other assemblies into its executing app domain. So naturally this means all those other assemblies must get their config values (for e.g. connection strings & app settings) from the web.config.Is there a way I can override this? Some of the configurations can come from the web.config; others must reside separately. What kind of an approach should I take in developing such .net assemblies? The goal is, once this application goes into the client environment, and the client decides to add assemblies somewhere in the distant future, he should be able to do so without hassles, and change the configuration for that assembly without affecting the others.So ultimately I must come out with a kind of framework-based approach? Is there already something to this effect? Or how do I go about this? What are the challenges I'd be faced with? 解决方案 The web config file allows you to create custom assembly specific configuration sections.Check out http://msdn.microsoft.com/en-us/library/2tw134k3.aspx for detailsAdditionally you can specify other files as configuration files to be used and parsed by the configuration parser in .netYou can do this using the config source option in your config files: e.g.in App.config/Web.config<configuration> <system.serviceModel> <services configSource="Services.config" > </services> </system.serviceModel></configuration>Create a file called Services.config and in it:<services> <service name="SomeNameSpace.MyService" behaviorConfiguration="MyServiceBehaviour"> <host> <baseAddresses> <add baseAddress="http://localhost:1234/service"/> </baseAddresses> </host> <endpoint address="net.tcp://localhost:8000/service" binding="netTcpBinding" bindingConfiguration="Binding1" contract="SomeNameSpace.IService" /> </service></services> 这篇关于.net 程序集和个人配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!