473,386 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Problem opening file

Hi

Here's my problem, I create a windows service with Config.xml file.
All setup for my service is in this file. I create a windows
application to manage these settings (Config.XML File). This work good
if the two applications are in the same folder and Config.XML is in
the folder too but If not, my windows application setting don't work.
In my windows form I have a Service controler components to manage my
service (start, stop, ...). With this component I can manage service
anywhere on a network using MachineName property. Is it possible to
use this same property to manage my Config.XML file ?

If my service run on computer 1 and I lauch my configuration
application on computer 2, I can manage (start, stop, ...) service on
computer 1 but I also want to manage Config.XML file on computer 1

Thanks
Jul 21 '05 #1
2 2051
Salut Eric. ;-)

I don't know if that's the answer to your point, but... at
least "my two cents" (been facing this problem too).

Once your app is set up as a service, you must place your
config.xml file under /System32/ folder .

Hope this helps.
olivier aka Cypher.

-----Original Message-----
Hi

Here's my problem, I create a windows service with Config.xml file.All setup for my service is in this file. I create a windowsapplication to manage these settings (Config.XML File). This work goodif the two applications are in the same folder and Config.XML is inthe folder too but If not, my windows application setting don't work.In my windows form I have a Service controler components to manage myservice (start, stop, ...). With this component I can manage serviceanywhere on a network using MachineName property. Is it possible touse this same property to manage my Config.XML file ?

If my service run on computer 1 and I lauch my configurationapplication on computer 2, I can manage (start, stop, ...) service oncomputer 1 but I also want to manage Config.XML file on computer 1
Thanks
.

Jul 21 '05 #2
Instead of placing the config file in the System32 folder, you could change
the working directory of the service (at service startup (first instruction
in OnStart() method)

Process pc = Process.GetCurrentProcess();
Directory.SetCurrentDirectory
(pc.MainModule.FileName.Substring(0,pc.MainModule. FileName.LastIndexOf(@"\")
));

In this way, you can place the .exe.config file in the same directory as the
exe file.

José

"|||Cypher|||" <oc*@c.com> a écrit dans le message de
news:06****************************@phx.gbl...
Salut Eric. ;-)

I don't know if that's the answer to your point, but... at
least "my two cents" (been facing this problem too).

Once your app is set up as a service, you must place your
config.xml file under /System32/ folder .

Hope this helps.
olivier aka Cypher.

-----Original Message-----
Hi

Here's my problem, I create a windows service with

Config.xml file.
All setup for my service is in this file. I create a

windows
application to manage these settings (Config.XML File).

This work good
if the two applications are in the same folder and

Config.XML is in
the folder too but If not, my windows application setting

don't work.
In my windows form I have a Service controler components

to manage my
service (start, stop, ...). With this component I can

manage service
anywhere on a network using MachineName property. Is it

possible to
use this same property to manage my Config.XML file ?

If my service run on computer 1 and I lauch my

configuration
application on computer 2, I can manage (start,

stop, ...) service on
computer 1 but I also want to manage Config.XML file on

computer 1

Thanks
.

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Graham Taylor | last post by:
I've tried posting this in the 'microsoft.public.access' but I will post it here also, as I think it might be the webserver which is causing my problem. --------- I have an Access 2003 database...
1
by: Alfons | last post by:
Hello, I have build a program that can do file transferring between a Windows XP computer and a DOS computer via a serial port. The Windows program I have build in C++ with Visual Studio 6.0....
5
by: John Morgan | last post by:
I am using the following link to download a file of about 50k <a target= "_blank" href="http://www.bsecs.org.uk/ExecDocs/documentStore/elfridaWord.doc">open file</a> If I save the file to...
8
by: beginner10 | last post by:
Hello! Can anyone help me? This code doesnt work. Where is the problem? Inside the files mata and matb there is (should be) 10*10 matrix. It should count a sum to new matrix. It does not work....
11
by: aldrin | last post by:
I'm trying to run this code under windows xp sp2 using codeblocks v1.0 compiler with great difficulty.There is no problem with running this under KDevelop in linux. Any help would be greatly...
0
by: anide | last post by:
Hi all I’ve some problem, I’m trying to converting a sorting algorithm from C++ to C#. In C++ I’ve compiled it using MSVC and its working properly, and in C# I’m using .NET Framework 2.0 (Visual...
0
by: nt91rx78 | last post by:
Our college changes 18 weeks semester to 16 semester, so our CS professor cannot finish teaching the last important chapter which is related with my problw\em. This is program C problem Anyone...
5
by: GeekBoy | last post by:
Thanks for the help obnoxious. Reading in the rest of the line with "getline" worked great and now the averages work. Now for the new problem. Program on first run works flawlessly. Next runs...
3
by: =?iso-8859-9?B?RGlu52F5IEFr5/ZyZW4=?= | last post by:
When I execute the following code #include <stdio.h> #include <stdlib.h> int main(void) { FILE *bmp; bmp = fopen("deneme.bmp","w"); fputc(10,bmp);
1
by: Sanjeeva K kanakam | last post by:
Hi all, I am developing one application. In that i have created on report file which contains tables, titles and tree view list also by using HTML tags. I am opening this file in my application it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.