Click here to Skip to main content
15,885,941 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I when Iam reading my xml file which is there in my wcf project folder with the below code it is throwing the error that file was not found .how can i resolve this ...

following is the code

C#
private XDocument ReadXMlfile()
        {

            return XDocument.Load(@"Myservice\ReadBookXml.xml");
        }
Posted
Comments
[no name] 23-Jan-15 6:52am    
I'm not familiar with WCF. But personally I would avoid relative path, because you can't make any assumption what the current directory is. So the conclusion is: Build and use the absolute filename to Access the file.
lakshmichawala 23-Jan-15 7:05am    
AppDomain.CurrentDomain.BaseDirectory.ToString() + "ReadBookXml.xml" is currently working fine
[no name] 23-Jan-15 7:21am    
Does it mean your Problem is solved?

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