Home All Groups Group Topic Archive Search About

Windows service problem with FTPWebRequest

Author
29 Mar 2006 3:49 PM
Frederik Wehlin
I've created an application that upload files to a ftp-server. Everything
works like a charm when doing this from a windows form. But when I try the
exact same thing from a Windows service I get an exception when calling the
GetRequestStream on the FTPWebRequest object i.e when trying to open the
stream to the ftp.

the errormessage i get is: The remote server returned an error: (550) File
unavailable (e.g., file not found, no access).

I assume this has something to do with securtiy and access. I've tried to
install the service under a admin user account as well as local system, but
neither work.

Can anyone lead me in the right direction to solve this issue?

Regards Frederik

Author
29 Mar 2006 4:44 PM
Cowboy (Gregory A. Beamer) - MVP
There are two potential security gotchas here:

1. The account for windows forms has access to the FTP server and the
service does not (use a domain account to run the service ... that has the
same types of rights to the FTP server as yours is the solution).

2. Access security on the box. IE, the service is not given rights to use
the services necessary to do what you desire. This is less likely, as you
have set it up under local admin.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************


Show quote
"Frederik Wehlin" wrote:

> I've created an application that upload files to a ftp-server. Everything
> works like a charm when doing this from a windows form. But when I try the
> exact same thing from a Windows service I get an exception when calling the
> GetRequestStream on the FTPWebRequest object i.e when trying to open the
> stream to the ftp.
>
> the errormessage i get is: The remote server returned an error: (550) File
> unavailable (e.g., file not found, no access).
>
> I assume this has something to do with securtiy and access. I've tried to
> install the service under a admin user account as well as local system, but
> neither work.
>
> Can anyone lead me in the right direction to solve this issue?
>
> Regards Frederik
Author
30 Mar 2006 7:37 AM
Frederik Wehlin
Thanx for your reply.

1. My local network is a workgroup and not a domain, and I've already tried
to installed the service with the same user account as when running the
windows form application.

2. How can change the rights for the service based on 2:nd gotcha?
Show quote
"Cowboy (Gregory A. Beamer) - MVP" wrote:

> There are two potential security gotchas here:
>
> 1. The account for windows forms has access to the FTP server and the
> service does not (use a domain account to run the service ... that has the
> same types of rights to the FTP server as yours is the solution).
>
> 2. Access security on the box. IE, the service is not given rights to use
> the services necessary to do what you desire. This is less likely, as you
> have set it up under local admin.
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
>
> ***************************
> Think Outside the Box!
> ***************************
>
>
> "Frederik Wehlin" wrote:
>
> > I've created an application that upload files to a ftp-server. Everything
> > works like a charm when doing this from a windows form. But when I try the
> > exact same thing from a Windows service I get an exception when calling the
> > GetRequestStream on the FTPWebRequest object i.e when trying to open the
> > stream to the ftp.
> >
> > the errormessage i get is: The remote server returned an error: (550) File
> > unavailable (e.g., file not found, no access).
> >
> > I assume this has something to do with securtiy and access. I've tried to
> > install the service under a admin user account as well as local system, but
> > neither work.
> >
> > Can anyone lead me in the right direction to solve this issue?
> >
> > Regards Frederik

AddThis Social Bookmark Button