python ruby-programming-language Smalltalk Vue.js Knockoutjs TypeScript JavaScript, OOPs JavaScript Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 4 Angular 2 AngularJs 1.x NodeJs Perl Programming R Programming RequireJs Rust Programming Backbonejs closure programming language go-programming-language kotlin-programming-language
An exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll but was not handled in user code

Exception from HRESULT: 0x80070005 (E_ACCESSDENIED) - Error : 80070005 Access is denied.

An exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll but was not handled in user code

Additional information: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

This Issue Is Occurring
When I tried to download excel file on cloud server! I debugging this code on the cloud server and find out, error is occurring at the time of creation of Microsoft.Office.Interop.Excel.Application object i.e.


using Excel = Microsoft.Office.Interop.Excel;
Excel.Application excel = new Excel.Application();

This is a COM permissions problem! I used forms authentication!

Firstly search Desktop folder in the below path – CREATE Desktop folder, if not exist!

For 64-bit (x64) - create this folder: C:\Windows\SysWOW64\config\systemprofile\Desktop
For 32-bit (x86) - create this folder: C:\Windows\System32\config\systemprofile\Desktop

Otherwise try to resolve below follow these steps - It might help you!
Solutions –
1.     Start => Run => dcomcnfg
2.     Open to Component Services => Component Services => Computers => My Computer => DCOM Config
3.     Find “Microsoft Excel Application”
4.     Right click => Properties
5.     Go to “Security Tab” and Edit the “Customize” radio buttons so that <Machine_name >/IIS_IUSRS could have rights for launch and access.
6.     Go to “Identity Tab” and choose “The interactive user”
7.     Apply changes and try again
References –


I hope you are enjoying with this post! Please share with you friends. Thank you!!
ANIL SINGH

Hi there! Welcome to my blog. My name is Anil Singh. I'm a author of this blog. For more detail about me, kindly refer to this link..
My Blogs - http://code-sample.com and http://code-sample.xyz
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like
www.code-sample.com/. Powered by Blogger.
ASK Questions