问题
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 DLL
s 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