Click here to Skip to main content
15,878,430 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a WCF web service which has references to some class library (BO.dll,BLL.dll,DAL.dll) ,and invoke their methods . one of the libraries(DAL.dll) need a config file to read some settings like connection string . then the config file is located near to the dll files . but when I use the service, it has error which the "could not find file C:\windows\microsoft.NET\FrameWork\v4.0.30319\Temporary ASP.NET Files\SampleService(some temp folder)\myConfigFile.config"
I should say that dll code read the config file as a simple xml file. and extract the settings.

why it looks for in this address ? where should I put the config file to be accessible by the dll file?
Posted
Updated 20-Nov-13 4:00am
v2

1 solution

When you try to access config files using the ConfigurationManager class in .Net from a dll it will actually reference the config file of wherever the dll is being hosted, in this case your web.config.

Yes, for dlls, I would recommend just having your own code for reading xml files and deploy the xml file with the dll. The alternative is to add the settings that the dll need into your web.config.
 
Share this answer
 
Comments
saeed_shokoohi 20-Nov-13 10:22am    
just as you said , I have my own code for reading xml file . but how to deploy the xml file with the dll? specially when they are referenced by a web service ?
ZurdoDev 20-Nov-13 10:26am    
Sorry, I misread. It looks like your code for opening the file may not be correct. I would recommend putting the xml file in the same directory as the dll or perhaps you can make it a requirement that a certain folder exist, sort of like Program Files\Your Folder\ and put it in there.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900