Reputation: 499
I am referencing a dll in my WCF project and this dll reads a .xml file using below code.
var path = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), Constants.Configuration.FileConstants.AEC_XML_FILE);
When I am deploying this WCF in IIS. It searches .xml file in below path -
"C:\Windows\system32\config\systemprofile\AppData\Roaming\Microsoft Corporation\Internet Information Services\7.5.7600.16385\Calculation.xml"
It should read .xml from bin folder of WCF but it is searching .xml from above path. What could be the reason?
Upvotes: 1
Views: 792
Reputation: 273429
Assembly.GetEntryAssembly()
will not give the path to your DLL (which isn't the entry point).
You can get the root folder for your Service with HostingEnvironment.MapPath("~").
Upvotes: 2