简体   繁体   English

外部dll引用了当前项目的web.config

[英]External dll is referencing current project's web.config

I've got two projects, WebAPI project as A and MVC4 project as B. The dll of A project is referenced in B project. 我有两个项目,作为A的WebAPI项目和作为B的MVC4项目。在B项目中引用了A项目的dll。 I found that A's dll is using the config setting in B's web.config. 我发现A的dll正在使用B的web.config中的config设置。 These projects have different definition for corresponding web.config. 这些项目对相应的web.config具有不同的定义。

So how can I do A's dll to use its own web.config and not to use B's web.config? 那么,我该如何使用A的dll使用其自己的web.config而不使用B的web.config?

The configuration file is read only from starter project. 该配置文件仅从入门项目中读取。 You can merge configs if they differ in appsettings or connectionstrings. 如果配置的应用程序设置或连接字符串不同,则可以合并它们。 But if they differ in system settings like .net version, authentication and so on, you should launch your projects separately. 但是,如果它们在.net版本,身份验证等系统设置上不同,则应单独启动项目。

You're doing strange things, because MVC4 has initial support for WebApi. 您正在做一些奇怪的事情,因为MVC4最初支持WebApi。 You can extract business logic from WebApi into another project. 您可以将业务逻辑从WebApi提取到另一个项目中。 Do you really need to have WebApi controllers in separate project? 您是否真的需要在单独的项目中使用WebApi控制器?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM