473,399 Members | 4,254 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,399 software developers and data experts.

Opening a remote file from web service code

I'm using C#:

Stream s = File.Open( @"\remotemachine\share\MyFile.txt"
, FileMode.Open
, FileAccess.Read
, FileShare.Read );

I'm getting the following exception:

"The referenced account is currently locked out and may
not be logged on to."

I'm admin on the remote machine.

Trying on another machine where I'm a simple user I get

"Could not find a part of the path "M:\MyFile.txt"

The file sits on another machine on the network. I change
the account settings in IIS Admin to use my domanin
account instead of the defual one (IUSR_...).

Can anyone point me into the right direction?

Thanks!
Daniel

Nov 23 '05 #1
4 7007
I also get

Logon failure: unknown user name or bad password.

if I use UNC instead of mapped drive.

-----Original Message-----
I'm using C#:

Stream s = File.Open( @"\remotemachine\share\MyFile.txt"
, FileMode.Open
, FileAccess.Read
, FileShare.Read );

I'm getting the following exception:

"The referenced account is currently locked out and may
not be logged on to."

I'm admin on the remote machine.

Trying on another machine where I'm a simple user I get

"Could not find a part of the path "M:\MyFile.txt"

The file sits on another machine on the network. I change
the account settings in IIS Admin to use my domanin
account instead of the defual one (IUSR_...).

Can anyone point me into the right direction?

Thanks!
Daniel

.

Nov 23 '05 #2
Well my first suggestion is to always use a UNC. mapped drives are
just an easy way for "humans" to get to network reources. When you
logon your computer your mapped drives are mapped for you each time you
logon, but when you logon as a service this mapping does not take
place. So use UNCs always. Another thing I would do is use
impersonation with the web service / web application to it will
impersonate the account calling the web service or web application.
Thus that users credientials are also used for retrieving the file

Nov 23 '05 #3
Good point! Thanks!
But this time I get

"Logon failure: unknown user name or bad password."

Daniel
-----Original Message-----
Well my first suggestion is to always use a UNC. mapped drives arejust an easy way for "humans" to get to network reources. When youlogon your computer your mapped drives are mapped for you each time youlogon, but when you logon as a service this mapping does not takeplace. So use UNCs always. Another thing I would do is useimpersonation with the web service / web application to it willimpersonate the account calling the web service or web application.Thus that users credientials are also used for retrieving the file
.

Nov 23 '05 #4
Are you hosting the service on a Windows 2003 server?

Apparently there are some issues with Windows 2003 when trying to
impersonate a user to a remote resource. We stumbled across a similar issue
when using SQL Reporting Services hosted on Windows 2003. We reinstalled the
entire reporting environment onto a Windows 2000 Server and the problem
immediately disappeared. These issues related to security problems access
resources on remote machines via a web application.

If you have access to a Windows 2000 server and you are currently using a
Windows 2003 server, this may be worth testing.

- Eric Giles

"Daniel P." <an*******@discussions.microsoft.com> wrote in message
news:25****************************@phx.gbl...
I'm using C#:

Stream s = File.Open( @"\remotemachine\share\MyFile.txt"
, FileMode.Open
, FileAccess.Read
, FileShare.Read );

I'm getting the following exception:

"The referenced account is currently locked out and may
not be logged on to."

I'm admin on the remote machine.

Trying on another machine where I'm a simple user I get

"Could not find a part of the path "M:\MyFile.txt"

The file sits on another machine on the network. I change
the account settings in IIS Admin to use my domanin
account instead of the defual one (IUSR_...).

Can anyone point me into the right direction?

Thanks!
Daniel

Nov 23 '05 #5

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

Similar topics

0
by: Cruinne | last post by:
Hello, In a JBoss 3.2.4 server, I have deployed several enterprise javabeans (each as a separate .jar, not in an .ear bundle). These beans are completely self-contained, as they include all...
15
by: JJ | last post by:
A current requirement I am facing is the all business objects be stateless remote components hosted in IIS. I am partial to web services myself. However, it is insisted that IIS hosted remoting be...
1
by: POnfri | last post by:
Hi, I have a problem in a peace of code were i'm doing a file copy using File.Copy. The Source is local and the target is a remote machine. Example: File.Copy(C:\temp\hi.txt,...
1
by: Jim Bayers | last post by:
Our network nazi doesn't want us running a webserver on the server that has a connection to the campus database so we created a remote object that runs as a windows service. The windows service...
7
by: Jorgen Haukland, Norway | last post by:
Hi, I have created a Java webservice which runs in IBM WebSphere appserver. I take the WSDL-file and create a VS.NET WinForm application and calls the service running on my PC and everything...
3
by: lk | last post by:
I need some help regarding the mechanism to put in place to be able to dynamically update a remote object when the assembly where it is defined is modified, and this whitout having service...
1
by: Thom Little | last post by:
I have a simple web service that requires no input and returns a character string. I created the service and FTPd it to a remote server. The .dll to the .bin directory and the single .asmx file...
3
by: windandwaves | last post by:
Hi Folk I am running a site (A) that has a US mirror (B). This means that all the data from A is copied daily to B. On the site, I keep some statistics of the pages people visit, tracking...
15
by: =?Utf-8?B?TVNU?= | last post by:
To demonstrate my problem, I have a very simple VB Windows application. It has a text box that is used to display a counter, a button to reset the counter, and a timer that increments the counter...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.