简体   繁体   中英

C# Console application calling a Web MVC DLL that reads Web.config fails to load Web.config values

I have a console application that references an C# MVC web project DLL. The console application calls into some of the functions exposed in the controller. The controller then goes onto call other model functions.

Since the controller reads setting from its Web.config file (located in its project), when the console application calls into the controller functions, the settings that the controller reads is all null.

Is there a way around this other than my overriding all the controller APIs to also take in these settings as a parameter?

您可以想到的选项:1.在App.config中具有相同的设置2.将Web.config中的设置移动到资源文件。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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