HighTechTalks DotNet Forums  

Access denied to file from ServicedComponent

Dotnet Framework (Component Services) microsoft.public.dotnet.framework.component_services


Discuss Access denied to file from ServicedComponent in the Dotnet Framework (Component Services) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
VK
 
Posts: n/a

Default Access denied to file from ServicedComponent - 11-06-2004 , 08:52 AM






I would greatly appreciate help on issue that looks as have been resolved
before:

I wrote a ServicedComponent that reads and writes files to a folder on a
network share.
Platform is Windows 2000.
It gets called by ASPNET (local account) that do not have access to the
folder.
But I configured this component to run as Server ([assembly:
ApplicationActivation(ActivationOption.Server)]) with following settings:
[assembly:
ApplicationAccessControl(true,AccessChecksLevel=Ac cessChecksLevelOption.ApplicationComponent,
Authentication=AuthenticationOption.Packet,
ImpersonationLevel=ImpersonationLevelOption.Impers onate)]

I set Identity to run under my domain account (in development environment).
I put this component into GAC and registered with regsvcs.exe

component method has line like:

FileInfo _file = new FileInfo("\\server01\share$\Data\somefile.pdf");

I am not getting any Exception, but in Wahtch window I see following:

((System.MarshalByRefObject)(((System.IO.FileSyste mInfo)(_file))))
__identity <undefined value> System.Object

ERROR_ACCESS_DENIED 5 int
ERROR_INVALID_PARAMETER 87 int
Length <error: an exception of type: {System.IO.IOException} occurred> long

That makes me think that I am missing something in configuration of the
Component.
Again, I would heartly apprecciate any clue on what I am missing with this
Component.



Reply With Quote
  #2  
Old   
Stan
 
Posts: n/a

Default Re: Access denied to file from ServicedComponent - 11-08-2004 , 11:49 AM






Don't use local account - set processModel account to a domain acount.

"VK" <vk (AT) nowhere (DOT) net> wrote

Quote:
I would greatly appreciate help on issue that looks as have been resolved
before:

I wrote a ServicedComponent that reads and writes files to a folder on a
network share.
Platform is Windows 2000.
It gets called by ASPNET (local account) that do not have access to the
folder.
But I configured this component to run as Server ([assembly:
ApplicationActivation(ActivationOption.Server)]) with following settings:
[assembly:

ApplicationAccessControl(true,AccessChecksLevel=Ac cessChecksLevelOption.Appl
icationComponent,
Quote:
Authentication=AuthenticationOption.Packet,
ImpersonationLevel=ImpersonationLevelOption.Impers onate)]

I set Identity to run under my domain account (in development
environment).
I put this component into GAC and registered with regsvcs.exe

component method has line like:

FileInfo _file = new FileInfo("\\server01\share$\Data\somefile.pdf");

I am not getting any Exception, but in Wahtch window I see following:

((System.MarshalByRefObject)(((System.IO.FileSyste mInfo)(_file))))
__identity <undefined value> System.Object

ERROR_ACCESS_DENIED 5 int
ERROR_INVALID_PARAMETER 87 int
Length <error: an exception of type: {System.IO.IOException} occurred
long

That makes me think that I am missing something in configuration of the
Component.
Again, I would heartly apprecciate any clue on what I am missing with this
Component.





Reply With Quote
  #3  
Old   
VK
 
Posts: n/a

Default Re: Access denied to file from ServicedComponent - 11-08-2004 , 09:26 PM



Yes, domain account has write permission (as well as administrator) on the
share.
Checked against normal share - the same result.

Also - since it is my first COM+ component - I noticed that I did not do
following:
- I did not have public interfaces in the Component, just public static
methods (inside of which I create an instance of the class)
- I did not set any roles for the Component

Should I have to have them?

Thanks in advance,
Victor Kh.



Reply With Quote
  #4  
Old   
VK
 
Posts: n/a

Default Re: Access denied to file from ServicedComponent - 11-10-2004 , 08:11 AM



Like I wrote before, I do have public methods:

public class fileMgr {

protected FileInfo fl;
public fileMgr() {}

public static long Copy (string sourceFileName, string targetFileName)
{
fileMgr mgr = new fileMgr();
mgr.fl = new FileInfo(sourceFileName);
if (mgr.fl.Exists)
{
mgr.fl.Copy(targetFileName)
}
else
{
throw new ex("Missing file " + sourceFileName);
}

}

}

In the web page I call:

fileMgr.Copy("\\server01\share$\Data01\somefile.pd f","\\server02\normalshare\Data02\newname.pdf") ;

Because of security problem I am always getting that file does not exists.
That why I am saying that it looks like I am missing something in
configuration of the COM+ component.
Tried different things - did not find any thing yet.
Any hint would be greatly appreciated

Vic



Reply With Quote
  #5  
Old   
VK
 
Posts: n/a

Default Re: Access denied to file from ServicedComponent - 11-11-2004 , 07:33 PM



Yes, I do. I see the icon spinning in Component Services control center when
I call the method.
I use my own domain account to make sure it has permissions to read/write on
the network share.
Maybe, I am missing any Service Pack?
Does it matter if I try this component on Win2K Workstation, not Server?

Victor

"Klaus H. Probst" <usenet001 (AT) vbbox (DOT) com> wrote

Quote:
Well, ultimately the issue here is the COM+ *security* configuration, not
the public interface of your components.

If you are getting an access denied exception then there's really not much
you can do except ensure that you *are* running the COM+ application under
the correct identity (have you verified that you are running in COM+ at
all?
If it's a server application, can you see it "spinning" when it activates
in
the COM+ admin?) and that it has the necessary permissions to read/write
that share.


--
Klaus H. Probst, MVP
http://www.vbbox.com/


"VK" <vk (AT) nowhere (DOT) net> wrote in message
newssokd.58128$fF6.25364174 (AT) news4 (DOT) srv.hcvlny.cv.net...
Like I wrote before, I do have public methods:

public class fileMgr {

protected FileInfo fl;
public fileMgr() {}

public static long Copy (string sourceFileName, string targetFileName)
{
fileMgr mgr = new fileMgr();
mgr.fl = new FileInfo(sourceFileName);
if (mgr.fl.Exists)
{
mgr.fl.Copy(targetFileName)
}
else
{
throw new ex("Missing file " + sourceFileName);
}

}

}

In the web page I call:


fileMgr.Copy("\\server01\share$\Data01\somefile.pd f","\\server02\normalshare
\Data02\newname.pdf");

Because of security problem I am always getting that file does not
exists.
That why I am saying that it looks like I am missing something in
configuration of the COM+ component.
Tried different things - did not find any thing yet.
Any hint would be greatly appreciated

Vic







Reply With Quote
  #6  
Old   
VK
 
Posts: n/a

Default Re: Access denied to file from ServicedComponent - 11-12-2004 , 09:51 PM



Quote:
If you use it as the COM+ identity, does it work?
If I understand correctly the question, I use this account for my COM+
component. I set up this component as Server application and changed
identity from Interactive user to this domain account. I thought, it would
be the trick of impersonation ( I set to Packet/Impersonate) of user - no it
does not work.
My domain account has Admin rights on both boxes - my Win2Pro and another
(where shares are - both: $ and public), that COM+ is accessing.

Victor

"Klaus H. Probst" <usenet001 (AT) vbbox (DOT) com> wrote

Quote:
"VK" <vk (AT) nowhere (DOT) net> wrote in message
news:4xTkd.66570$fF6.30308322 (AT) news4 (DOT) srv.hcvlny.cv.net...
Yes, I do. I see the icon spinning in Component Services control center
when
I call the method.

OK, just checking.

I use my own domain account to make sure it has permissions to read/write
on
the network share.

If you use it as the COM+ identity, does it work?

Maybe, I am missing any Service Pack?

Well, I'd make sure you have the latest of everything but a simple thing
like should work regardless.

Does it matter if I try this component on Win2K Workstation, not Server?

No, they behave exactly the same.

The other thing I could think of is maybe a firewall that's blocking
traffic
from one server to another?

FWIW, I'm running W2KPro here and I just tried a simple COM+ app under a
domain account and I can access the c$ share on my Windows 2003 server
after
making the account an admin on the box.


--
Klaus H. Probst, MVP
http://www.vbbox.com/





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.