473,806 Members | 2,944 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

2nd opinion? - Windows service app development

I have not touched a Windows Service app since my MCAD certs (about 5 years
ago...) I've just been assigned to write a quickie app. I could use a 2nd
opinion here.

The app is to be written in Dot Net 2.0 (VB). Probably all it will do is
monitor a directory (at intervals controled by a timer), do some stuff with
text files, and ftp text files to an ftp. I believe I've successfully tested
most of the techniques I'll be using but I was wondering about the status of
the ServiceProcessI nstaller's Account setting. 'LocalSystem' seems to works
fine. "LocalServi ce' works fine as well, if I give 'Local Service' full
access to the directory.

So I suppose my question is, given the above, should I prefer using
"LocalSyste m" or "LocalServi ce"? (Are there any 'gotchas' with either in a
situation like this?)

Jul 11 '08 #1
7 1359
I would say you'd be better off running under the account of least
privelege, as long as your service will still work. Is there any reason
you'd need LocalSystem privs (i.e. higher even than an administrator)?

I would configure a custom action in the installer so that it automatically
grants LocalService access to the directory it watches, and run it under
that. Search the MS webby for a description of the privs granted to
LocalService also, you might find there's something in there that's too
restrictive, but I doubt it.

There are very few apps these days that genuinely need Admin privs to run,
let alone anything higher, but your best option is to research and find out
exactly what you need.

-Alex
"B. Chernick" <BC*******@disc ussions.microso ft.comwrote in message
news:28******** *************** ***********@mic rosoft.com...
>I have not touched a Windows Service app since my MCAD certs (about 5 years
ago...) I've just been assigned to write a quickie app. I could use a
2nd
opinion here.

The app is to be written in Dot Net 2.0 (VB). Probably all it will do is
monitor a directory (at intervals controled by a timer), do some stuff
with
text files, and ftp text files to an ftp. I believe I've successfully
tested
most of the techniques I'll be using but I was wondering about the status
of
the ServiceProcessI nstaller's Account setting. 'LocalSystem' seems to
works
fine. "LocalServi ce' works fine as well, if I give 'Local Service' full
access to the directory.

So I suppose my question is, given the above, should I prefer using
"LocalSyste m" or "LocalServi ce"? (Are there any 'gotchas' with either in
a
situation like this?)

Jul 12 '08 #2
B. Chernick wrote:
I have not touched a Windows Service app since my MCAD certs (about 5
years ago...) I've just been assigned to write a quickie app. I
could use a 2nd opinion here.

The app is to be written in Dot Net 2.0 (VB). Probably all it will
do is monitor a directory (at intervals controled by a timer), do
some stuff with text files, and ftp text files to an ftp. I believe
I've successfully tested most of the techniques I'll be using but I
was wondering about the status of the ServiceProcessI nstaller's
Account setting. 'LocalSystem' seems to works fine. "LocalServi ce'
works fine as well, if I give 'Local Service' full access to the
directory.

So I suppose my question is, given the above, should I prefer using
"LocalSyste m" or "LocalServi ce"? (Are there any 'gotchas' with
either in a situation like this?)
LocalService should be okay, except I would wonder about ftp'ing files. That
implies going out over the network. LocalService would not necessarily have
access to the external network resources you need, depending on what they are.

I have had a service running under LocalService for over a year now, with no
snags. It does not do any ftp, but it does send emails out over the network. You
might want to look at using a FileSystemWatch er instead of a timer to monitor a
directory; that has worked very well for me.

Jul 12 '08 #3
Steve Gerrard wrote:
I have had a service running under LocalService for over a year now,
with no snags. It does not do any ftp, but it does send emails out
over the network.
Whoops, I lied, it is running under LocalSystem (just checked it remotely). Not
sure why. No problems, though.
Jul 12 '08 #4
What Steve just said about FTP'ing reminded me of something - I'm not sure
that LocalService gets external network access, whereas "NETWORK SERVICE"
should. Other than that, like I said before, investigate the privs
associated with all 3 accounts to see which is best for you.

-Alex
"Steve Gerrard" <my********@com cast.netwrote in message
news:kL******** *************** *******@comcast .com...
B. Chernick wrote:
>I have not touched a Windows Service app since my MCAD certs (about 5
years ago...) I've just been assigned to write a quickie app. I
could use a 2nd opinion here.

The app is to be written in Dot Net 2.0 (VB). Probably all it will
do is monitor a directory (at intervals controled by a timer), do
some stuff with text files, and ftp text files to an ftp. I believe
I've successfully tested most of the techniques I'll be using but I
was wondering about the status of the ServiceProcessI nstaller's
Account setting. 'LocalSystem' seems to works fine. "LocalServi ce'
works fine as well, if I give 'Local Service' full access to the
directory.

So I suppose my question is, given the above, should I prefer using
"LocalSystem " or "LocalServi ce"? (Are there any 'gotchas' with
either in a situation like this?)

LocalService should be okay, except I would wonder about ftp'ing files.
That implies going out over the network. LocalService would not
necessarily have access to the external network resources you need,
depending on what they are.

I have had a service running under LocalService for over a year now, with
no snags. It does not do any ftp, but it does send emails out over the
network. You might want to look at using a FileSystemWatch er instead of a
timer to monitor a directory; that has worked very well for me.

Jul 13 '08 #5
?? Well so far it seems to work with LocalService. I do have to add a
credential object.

Dim uploadRequest As FtpWebRequest = WebRequest.Crea te(uploadUrl)
Dim cred As NetworkCredenti al = uploadRequest.C redentials
cred.UserName = "myUserName "
cred.Password = "myPassword "
"Alex Clark" wrote:
What Steve just said about FTP'ing reminded me of something - I'm not sure
that LocalService gets external network access, whereas "NETWORK SERVICE"
should. Other than that, like I said before, investigate the privs
associated with all 3 accounts to see which is best for you.

-Alex
"Steve Gerrard" <my********@com cast.netwrote in message
news:kL******** *************** *******@comcast .com...
B. Chernick wrote:
I have not touched a Windows Service app since my MCAD certs (about 5
years ago...) I've just been assigned to write a quickie app. I
could use a 2nd opinion here.

The app is to be written in Dot Net 2.0 (VB). Probably all it will
do is monitor a directory (at intervals controled by a timer), do
some stuff with text files, and ftp text files to an ftp. I believe
I've successfully tested most of the techniques I'll be using but I
was wondering about the status of the ServiceProcessI nstaller's
Account setting. 'LocalSystem' seems to works fine. "LocalServi ce'
works fine as well, if I give 'Local Service' full access to the
directory.

So I suppose my question is, given the above, should I prefer using
"LocalSyste m" or "LocalServi ce"? (Are there any 'gotchas' with
either in a situation like this?)
LocalService should be okay, except I would wonder about ftp'ing files.
That implies going out over the network. LocalService would not
necessarily have access to the external network resources you need,
depending on what they are.

I have had a service running under LocalService for over a year now, with
no snags. It does not do any ftp, but it does send emails out over the
network. You might want to look at using a FileSystemWatch er instead of a
timer to monitor a directory; that has worked very well for me.



Jul 14 '08 #6
Thanks. Interesting concepts. When you say 'custom action in the
installer', are you refering to the ServiceInstalle r or the
ServiceProcessI nstaller? (I need to do more reading about those two.)

Also, is it possible under these conditions to somehow generate a popup
input window during installation? (Given that a Windows Service itself
cannot directly generate a form.) I've got to give configuration control
some thought because userid, password, and directory to monitor will probably
all have to be set at install time. (And made available for edit later.)

"Alex Clark" wrote:
I would say you'd be better off running under the account of least
privelege, as long as your service will still work. Is there any reason
you'd need LocalSystem privs (i.e. higher even than an administrator)?

I would configure a custom action in the installer so that it automatically
grants LocalService access to the directory it watches, and run it under
that. Search the MS webby for a description of the privs granted to
LocalService also, you might find there's something in there that's too
restrictive, but I doubt it.

There are very few apps these days that genuinely need Admin privs to run,
let alone anything higher, but your best option is to research and find out
exactly what you need.

-Alex
"B. Chernick" <BC*******@disc ussions.microso ft.comwrote in message
news:28******** *************** ***********@mic rosoft.com...
I have not touched a Windows Service app since my MCAD certs (about 5 years
ago...) I've just been assigned to write a quickie app. I could use a
2nd
opinion here.

The app is to be written in Dot Net 2.0 (VB). Probably all it will do is
monitor a directory (at intervals controled by a timer), do some stuff
with
text files, and ftp text files to an ftp. I believe I've successfully
tested
most of the techniques I'll be using but I was wondering about the status
of
the ServiceProcessI nstaller's Account setting. 'LocalSystem' seems to
works
fine. "LocalServi ce' works fine as well, if I give 'Local Service' full
access to the directory.

So I suppose my question is, given the above, should I prefer using
"LocalSyste m" or "LocalServi ce"? (Are there any 'gotchas' with either in
a
situation like this?)


Jul 14 '08 #7
You can create a Setup project which handles installation of your service,
and add a custom action to the Setup project which includes giving the user
the option of configuration. This doesn't break the service guidelines as
the installer isn't actually running the service, it's just installing it,
therefore it's fine to have a GUI.

In terms of users editing that config info at a later date, you'd need a
separate exe to allow them to do that; one which is a standard
winforms/console app and not a service.

Regarding your other email, it sounds like LocalService will work out for
you in that case? I'm a little surprised that LocalService is giving you
network access, but if it works then cool :-)

"B. Chernick" <BC*******@disc ussions.microso ft.comwrote in message
news:5D******** *************** ***********@mic rosoft.com...
Thanks. Interesting concepts. When you say 'custom action in the
installer', are you refering to the ServiceInstalle r or the
ServiceProcessI nstaller? (I need to do more reading about those two.)

Also, is it possible under these conditions to somehow generate a popup
input window during installation? (Given that a Windows Service itself
cannot directly generate a form.) I've got to give configuration control
some thought because userid, password, and directory to monitor will
probably
all have to be set at install time. (And made available for edit later.)

"Alex Clark" wrote:
>I would say you'd be better off running under the account of least
privelege, as long as your service will still work. Is there any reason
you'd need LocalSystem privs (i.e. higher even than an administrator)?

I would configure a custom action in the installer so that it
automaticall y
grants LocalService access to the directory it watches, and run it under
that. Search the MS webby for a description of the privs granted to
LocalService also, you might find there's something in there that's too
restrictive, but I doubt it.

There are very few apps these days that genuinely need Admin privs to
run,
let alone anything higher, but your best option is to research and find
out
exactly what you need.

-Alex
"B. Chernick" <BC*******@disc ussions.microso ft.comwrote in message
news:28******* *************** ************@mi crosoft.com...
>I have not touched a Windows Service app since my MCAD certs (about 5
years
ago...) I've just been assigned to write a quickie app. I could use a
2nd
opinion here.

The app is to be written in Dot Net 2.0 (VB). Probably all it will do
is
monitor a directory (at intervals controled by a timer), do some stuff
with
text files, and ftp text files to an ftp. I believe I've successfully
tested
most of the techniques I'll be using but I was wondering about the
status
of
the ServiceProcessI nstaller's Account setting. 'LocalSystem' seems to
works
fine. "LocalServi ce' works fine as well, if I give 'Local Service'
full
access to the directory.

So I suppose my question is, given the above, should I prefer using
"LocalSyste m" or "LocalServi ce"? (Are there any 'gotchas' with either
in
a
situation like this?)



Jul 14 '08 #8

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

Similar topics

5
5093
by: Dhilip Kumar | last post by:
Hi all, I have developed a windows service using the windows service project template in VS.NET. I have used three controls in the service, a timer, performance counter and a message queue control. The service will "sleep" for 'n' seconds using the timer control and whenever the timer_elapsed event occurs, I use the performance counter object to determine availability of few resources. Based on the availability of resources, I use the...
3
57011
by: Jeremy S. | last post by:
On my dev machine (XP/Pro with VS.NET 2003) I have been developing a Windows Service and installing it on the local machine by opening the Visual Studio Command Prompt and then executing . Now I want to test this service on a Windows Server 2003 box that doesn't have the Visual Studio Command prompt. How do I go about installing the service on the Windows Server 2003 box? Thanks!
6
6723
by: Microsoft | last post by:
I'm new to CSharp, previously having done all my development in Delphi. I need to create a service, and for the development cycle I wish it to be an interactive service and use message boxes to show various messages. I know I can set the interactive property via the SMC, but I would rather set it programmatically so I do not have to get in and out of the SMC each and every time. Is this even possible? Thanx!
5
16700
by: R. Ian Lee | last post by:
I'm using the System.Web.Mail.SmtpMail object (.NET 1.1) to send email from an ASP.NET application. Everything works fine when I run it from Windows 2000 Server, but not from WinXP Pro. Is it not possible to send mail using the SMTP service or XP? Is there a different class that I should be using? I don't really need to send email from XP, but since I'm doing my development from XP it's really slows down debugging to have to comment...
0
2230
by: Charles Leonard | last post by:
I am having yet another issue with Windows Server 2003. This time, the web service (a file import web service) appears to run except for one odd message: "ActiveX component can't create object". There are no other statements to indicate what object cannot be created. Otherwise, everything on the test Windows Server 2003 works fine—all import data updates correctly. Unfortunately, my normal development environment is not Windows...
0
1271
by: jpegny | last post by:
Hello all, I'm in the middle of setting up a windows 2003 server for asp.net (with vb.net 2003) remote development/deployment. The problem is that as soon as I install service pack 1 on windows 2003 I can no longer remotely develop asp.net apps with vs.net 2003. I have set-up servers with all the patches except service pack 1 and they work fine but as soon as I install service pack 1 it breaks the remote development of asp.net.
8
1680
by: JimS | last post by:
In my environment we are using DB2 UDB for Windows for development and DB2 UDB for z/OS for production. In DB2 UDB for z/OS uniqueness of columns that permit nulls may be enforced with a unique index created with the "WHERE NOT NULL" parameter; this has the effect of ensuring that not null columns are unique while not considering null columns to be duplicates. Does anyone know of a way to duplicate this behavior with DB2 UDB for Windows?
3
1557
by: rkausch | last post by:
Hello, I'm performing some research to determine the feasibility of developing a Windows Service (see http://en.wikipedia.org/wiki/Windows_Service for the specific definition of "service" to which I'm referring) to perform a particular task. I'm having some trouble determining if a service's functionality can be accessed in a non-I/O manner (such as avoiding Sockets, reading and writing a temp file, etc). Basically, I'd like to call a...
6
595
by: Chris Marsh | last post by:
All I have a database table, changes to the data within which I am interested in acting on. The approach that I'm taking is to have the database update a file every time data is updated. This process is outside my domain - I can rely on the file being updated when data changes. Within my domain is the design of a Windows service to perform the operations required when the data changes. I have not produced a Windows service before...
0
9719
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10369
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10372
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10110
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9187
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4329
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3851
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.