Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two project in one solution.
1st project is WCF
2nd project is Class Library
All the Logic of Service is in Class Library.

I wan to read xml file which is include in WCF project from Class Library project.

My code in class library is
XmlDocument XmlDocParent = new XmlDocument();

XmlDocParent.Load("Test.xml");



I also try with below approach
XmlDocParent.Load("~/Test.xml");
XmlDocParent.Load("../Test.xml");


But its giving me error as
File Not found exception.
Could not find file 'C:\Program Files (x86)\IIS Express\Test.xml'.
Posted
Updated 4-Dec-14 0:02am
v2
Comments
Kornfeld Eliyahu Peter 4-Dec-14 6:09am    
And the file is there?
Suvabrata Roy 4-Dec-14 6:09am    
You can find your base path using : http://msdn.microsoft.com/en-us/library/aa457089.aspx

And then add the XML file path with it
Maciej Los 4-Dec-14 7:10am    
Are you sure that file: Test.xml exists in this destination: C:\Program Files (x86)\IIS Express\?
ZurdoDev 4-Dec-14 7:30am    
Either the file isn't there or there is a permissions issue.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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