Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Unable to read the XML from a specified path in Window Service
 

Unable to read the XML from a specified path in Window Service

Hi,

I have installed the Windows Service using the MSI setup.
From the Window Service I am trying to read the XML using the mentioned code:

path = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory).FullName;
var custs = from c in XElement.Load(path).Elements("Record") select c;

But when I am running the Service getting the error as : Error on
mscorlib at Could not find a part of the path 'D:\EDS\MailScheduler\'.

Can anyone please help?

Regards,

Afreen
  • Moved byeryangMSFTFriday, September 11, 2009 3:05 AM (From:.NET Base Class Library)
  •  
Afreen_IT  Wednesday, September 09, 2009 6:21 AM
Hi,
When you creating a setup you added the config file?
if not right click add file.and build it your set up ready..
Best Regards, C.Gnanadurai ----------------------- Please mark the post as answer if it is helpfull to you
  • Marked As Answer byAfreen_IT Friday, September 11, 2009 9:56 AM
  •  
Gnanadurai  Wednesday, September 09, 2009 9:39 AM
Hi,
Check your config file available in the given path 'D:\EDS\MailScheduler.
otherwise copy your xml file in system32 folder.
Environment.SystemDirectory
i hope it will help you
Best Regards, C.Gnanadurai ----------------------- Please mark the post as answer if it is helpfull to you
Gnanadurai  Wednesday, September 09, 2009 6:52 AM
Hi Gnanadura,

Thanks for the response.
I have checked the xml is there at the specified path.

I am able to access the xml when I install the Window Service by InstallUtil utility. But, when I install the Window Service by using the Setup and Deployment of .NET, it gives the error.

Can you please help?

Regards,

Afreen
Afreen_IT  Wednesday, September 09, 2009 8:16 AM
Hi,
Have a look at this link
http://msdn.microsoft.com/en-us/library/zt39148a.aspx
Best Regards, C.Gnanadurai ----------------------- Please mark the post as answer if it is helpfull to you
Gnanadurai  Wednesday, September 09, 2009 8:28 AM
Hi,

The article is good, but not much helpful to me.

I think there is some issue with the installation.

Regards,

Afreen
Afreen_IT  Wednesday, September 09, 2009 9:01 AM
Hi,
When you creating a setup you added the config file?
if not right click add file.and build it your set up ready..
Best Regards, C.Gnanadurai ----------------------- Please mark the post as answer if it is helpfull to you
  • Marked As Answer byAfreen_IT Friday, September 11, 2009 9:56 AM
  •  
Gnanadurai  Wednesday, September 09, 2009 9:39 AM
Hi,

Yes there is App.config file in the Windows Service project.
The same config file was included when the Setup was created.

Regards,

Afreen
Afreen_IT  Wednesday, September 09, 2009 9:53 AM
Hi,

Can anyone provide some more solutions to the issue?

Regards,

Afreen
Afreen_IT  Thursday, September 10, 2009 7:10 AM
Accoding to your question, the service works well if it is installed by InstallUtil utility, but when the service is deployed by a msi exe file, it shows an error.
Seems something missed when create the Setup or deploy the service, I redirected this post toSetup & Deployment Forum for better support.

Thanks,
Eric

Please remember to mark helpful replies as answers and unmark them if they provide no help.
eryang  Friday, September 11, 2009 3:04 AM

Is that all of your exact code? I'm wondering, because one of the ways you get that error is by putting together path strings to get a complete file path, but some of the paths are quoted. You end up with "D:\Some long quoted name"\dir1\file.xml and that's not valid.

How about D: ? Is it a mapped drive? Is it this?
http://support.microsoft.com/default.aspx/kb/827421


Phil Wilson
PhilWilson  Friday, September 11, 2009 11:33 PM

You can use google to search for other answers

Custom Search

More Threads

• How to stop application execution before installation completes?
• bootstrap problem
• How to deploy data files with ClickOnce
• Errors with VB 2005 Express app on Windows 2000
• How do i make installer?
• Makecab ddf file contains umlaut
• Open html page after update
• Deploying a ClickOnce application when referencing other projects
• http headers and clickonce
• put the msi file in a different folder