Using a DLL in the Web API Project

喜你入骨 提交于 2021-01-28 08:37:21

问题


I want to use a dll which communicates with a server, while using the DLL in the Console Application in C# it worked fine. But when I am using the DLLs in the Web API project it is not making any logs and also not returning correct response.

The DLL uses a .config file which should be present in the same location as that of the DLL. I have pasted the config file in the bin folder in both the cases but still got the different results.

what would be the possible reason behind this.


回答1:


IIS uses Shadow Copying, i.e. it copies all DLLs from bin into temporary folder. Your configuration file is probably not copied during this process, causing your communication DLL to fail in finding it's .config.

You could either copy .config file to target temporary bin folder during application startup, or disable shadow copying in web.config (with all it's side effects).



来源:https://stackoverflow.com/questions/51803037/using-a-dll-in-the-web-api-project

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!