Home All Groups Group Topic Archive Search About

Access denied with interop

Author
22 Apr 2005 11:41 AM
a95johjo
The following code running in a C# windows forms application gives me
an "Access denied" error message:

private void Form1_Load(object sender, System.EventArgs e)
{
crash    >>>    Word.Application app = new Word.ApplicationClass();

}


Even though:
1. I run as a user that is a member of administrators group.
2. It has worked before, and still works maybe 1 time out of 10.
(timing problem???)
3. It works on another computer.

I run Windows XP SP2, .Net framework 1.1.
Word is Word XP. However it also crasches if I do
Illustrator.Application app = new Illustrator.ApplicationClass(); so
it seems to be more of a Interop problem than a word problem.
MOREOVER: It works by running equivalent code as a vb script!!! How
the #¤!% can that be????? I've tried FileMon and RegMon with no
leading result.

Please if anyone could give a clue I would be very grateful.

Best regards
Johan

Author
22 Apr 2005 9:54 PM
Harry
if you are using web application try <identity imporsonate="true"/> in
web.config file. The other option is to go to
1. run
2. open dconcnfg
3.  browse to dcom folder under dcom located Microsoft Word Application
4. go to properties and under security tab add the ASPNET account to the list.

Show quoteHide quote
"a95jo***@hotmail.com" wrote:

> The following code running in a C# windows forms application gives me
> an "Access denied" error message:
>
> private void Form1_Load(object sender, System.EventArgs e)
> {
> crash    >>>    Word.Application app = new Word.ApplicationClass();
>
> }
>
>
> Even though:
> 1. I run as a user that is a member of administrators group.
> 2. It has worked before, and still works maybe 1 time out of 10.
> (timing problem???)
> 3. It works on another computer.
>
> I run Windows XP SP2, .Net framework 1.1.
> Word is Word XP. However it also crasches if I do
> Illustrator.Application app = new Illustrator.ApplicationClass(); so
> it seems to be more of a Interop problem than a word problem.
> MOREOVER: It works by running equivalent code as a vb script!!! How
> the #¤!% can that be????? I've tried FileMon and RegMon with no
> leading result.
>
> Please if anyone could give a clue I would be very grateful.
>
> Best regards
> Johan
>
Author
25 Apr 2005 8:13 AM
a95johjo
Thanks, but this is a windows application, so ASPNET user is AFAIK not
involved.
Since I'm running this as an user that is member of Administrators
group, I can't understand how this can be.
As told, it works when I run a vb-script doing the same thing. Seems a
..net bug to me.
/ Johan

Harry wrote:
Show quoteHide quote
> if you are using web application try <identity imporsonate="true"/>
in
> web.config file. The other option is to go to
> 1. run
> 2. open dconcnfg
> 3.  browse to dcom folder under dcom located Microsoft Word
Application
> 4. go to properties and under security tab add the ASPNET account to
the list.
>
> "a95jo***@hotmail.com" wrote:
>
> > The following code running in a C# windows forms application gives
me
> > an "Access denied" error message:
> >
> > private void Form1_Load(object sender, System.EventArgs e)
> > {
> > crash    >>>    Word.Application app = new Word.ApplicationClass();
> >
> > }
> >
> >
> > Even though:
> > 1. I run as a user that is a member of administrators group.
> > 2. It has worked before, and still works maybe 1 time out of 10.
> > (timing problem???)
> > 3. It works on another computer.
> >
> > I run Windows XP SP2, .Net framework 1.1.
> > Word is Word XP. However it also crasches if I do
> > Illustrator.Application app = new Illustrator.ApplicationClass();
so
> > it seems to be more of a Interop problem than a word problem.
> > MOREOVER: It works by running equivalent code as a vb script!!! How
> > the #¤!% can that be????? I've tried FileMon and RegMon with no
> > leading result.
> >
> > Please if anyone could give a clue I would be very grateful.
> >
> > Best regards
> > Johan
> >
Author
2 May 2005 11:04 AM
a95johjo
I still have the problem, it seems to come down to that the problem
came when the computer was moved from a workgroup to a domain. The user
switched from workgroup to domain user with the same user name (however
with different user profile). I've tried to change name of the old user
and disable it but nothing works. The domain is a Linux Samba trying to
behave like a NT4 Domain. I haven't found any file permission error
(that should have been visible in FileMon, right?)
Maybe a reinstallation of windows is the only solution....
Yawn.
Author
26 May 2005 7:33 AM
a95johjo
I found out it's a problem with Oracle Client, moved this issue to
comp.databases.oracle.misc.