all groups > dotnet component services > november 2004 >
You're in the

dotnet component services

group:

Access denied to file from ServicedComponent


Access denied to file from ServicedComponent VK
11/6/2004 1:52:55 PM
dotnet component services:
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=AccessChecksLevelOption.ApplicationComponent,
Authentication=AuthenticationOption.Packet,
ImpersonationLevel=ImpersonationLevelOption.Impersonate)]

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.FileSystemInfo)(_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.

Re: Access denied to file from ServicedComponent Klaus H. Probst
11/8/2004 1:27:00 AM
Serviced components do not need to be in the GAC.

I'll ask the obvious question: Does the domain account have rights to
read/write to that network share? You do realize that "share$" (I assume
this is a physical drive) is an "admin share" and requires the account to be
an administrator on the box that hosts the share itself? What happens if you
create a normal share and try to hit that instead?


--

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


[quoted text, click to view]
ApplicationAccessControl(true,AccessChecksLevel=AccessChecksLevelOption.Appl
icationComponent,
[quoted text, click to view]

Re: Access denied to file from ServicedComponent Stan
11/8/2004 11:49:34 AM
Don't use local account - set processModel account to a domain acount.

[quoted text, click to view]
ApplicationAccessControl(true,AccessChecksLevel=AccessChecksLevelOption.Appl
icationComponent,
[quoted text, click to view]

Re: Access denied to file from ServicedComponent VK
11/9/2004 2:26:24 AM
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.

Re: Access denied to file from ServicedComponent Klaus H. Probst
11/10/2004 12:20:01 AM
You have to have public methods in the class hosted by COM+, otherwise you
won't be able to call anything on it =)

Roles are for *client* authentication. If you turn on security for the COM+
application then you need at least one role with one account (or group) in
it to access the components in the application. Otherwise you don't need
roles.

--

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


[quoted text, click to view]

Re: Access denied to file from ServicedComponent VK
11/10/2004 1:11:48 PM
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.pdf","\\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

Re: Access denied to file from ServicedComponent Klaus H. Probst
11/10/2004 9:39:41 PM
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/


[quoted text, click to view]
fileMgr.Copy("\\server01\share$\Data01\somefile.pdf","\\server02\normalshare
\Data02\newname.pdf");
[quoted text, click to view]

Re: Access denied to file from ServicedComponent Klaus H. Probst
11/11/2004 10:42:12 PM

[quoted text, click to view]

OK, just checking.

[quoted text, click to view]

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

[quoted text, click to view]

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

[quoted text, click to view]

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/

Re: Access denied to file from ServicedComponent VK
11/12/2004 12:33:04 AM
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

[quoted text, click to view]

Re: Access denied to file from ServicedComponent VK
11/13/2004 2:51:13 AM
[quoted text, click to view]

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

[quoted text, click to view]

AddThis Social Bookmark Button