Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / October 2007

Tip: Looking for answers? Try searching our database.

DCOM Issue with Excel

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael Burgess - 19 Oct 2007 13:15 GMT
Hi there,

When I try to get an instance of my Excel application in code I get an
UnauthorizedAccessException thrown with 'Access Is Denied'.

I've heard that DCOM needs permissioning to allow access, but I'm not
sure how. I've tried adding ASPNET into the security as a user with
the rights to do so, but no joy. The ASP.NET app in question has
anonymous access disabled - does that make any difference?

Any ideas? Not found anything that's worked for me yet on the net.

Cheers,
Michael.
Scott M. - 19 Oct 2007 13:59 GMT
How are you trying to get your Excel instance.  What makes you think you are
using DCOM?

> Hi there,
>
[quoted text clipped - 10 lines]
> Cheers,
> Michael.
Michael Burgess - 23 Oct 2007 10:21 GMT
> How are you trying to get your Excel instance.  What makes you think you are
> using DCOM?
[quoted text clipped - 15 lines]
>
> - Show quoted text -

This is the call that throws the exception..............

excelApp = new Microsoft.Office.Interop.Excel.Application();

Any ideas?

I'm not desperate to find out as it turns out the production problem
was a data error, but I'm sure I'll have to make changes soon and I'll
need my dev PC to work properly with the site.

Thanks,
Michael.
Scott M. - 23 Oct 2007 16:03 GMT
>> How are you trying to get your Excel instance.  What makes you think you
>> are
[quoted text clipped - 29 lines]
> Thanks,
> Michael.

I have a couple of thoughts on this.  First, this is not DCOM at all.  DCOM
has to do with utilizing an object across the LAN using MS proprietary
technology.  This is InterOperability between a .NET assembly and a COM
component.

Microsoft recommends using the PIA's (Primary InterOp Assemblies when
connecting to Office libraries as these assemblies have been built
specifically for this purpose.

Here is a nice article describing the Office PIA's and it contains links to
their usage - perhaps it will help.

http://msdn2.microsoft.com/en-us/library/kh3965hw(VS.80).aspx

Good luck.

-Scott
Michael Burgess - 23 Oct 2007 16:13 GMT
> >> How are you trying to get your Excel instance.  What makes you think you
> >> are
[quoted text clipped - 53 lines]
>
> - Show quoted text -

Thanks Scott, I'll take a look - have to admit I know nada about DCOM,
hence my naivety!
Alvin Bruney [MVP] - 27 Oct 2007 03:08 GMT
A couple things can cause this chiefly that the Excel object isn't correctly
registered. It will usually throw a null reference object, but I have seen
it throw exceptions related to permissions access. Secondly, your ASP.NET
application runs least privilege meaning that your worker process trying
automate Excel may not have sufficient permission. You can determine which
of the two is the issue by turning CAS off at a command prompt (cas -s off)
and running the application. If it works, bump your worker process
permissions up a notch. If it still fails, go register the Excel object.

I don't suspect this is a PIA issue but it may be solved by installing the
PIAs again, which would point to registration issue.
Signature

Regards,
Alvin Bruney
------------------------------------------------------
Shameless Author Plug
OWC Black Book 2nd Edition
Exclusively on www.lulu.com/owc
$24.99

>> >> How are you trying to get your Excel instance.  What makes you think
>> >> you
[quoted text clipped - 61 lines]
> Thanks Scott, I'll take a look - have to admit I know nada about DCOM,
> hence my naivety!

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.