The handle is Invalid. IIS Windows Authentication Error.

Jul 12, 2012 at 1:20 AM

Hi, I have a MVC 3 app that is giving me this error when I try running EPPLus. It works fine locally with Windows Authentication (Win 7 64 Pro) but when I deploy to the server it fails with Windows Authentication on. If I switch WIndows Authentication off then I dont get the error.

Any help on this would be great.

Thanks, Dave

Exception Details: System.Runtime.InteropServices.COMException: The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Jul 12, 2012 at 1:49 AM

It appears that impersonation = "true" causes this issue but I dont know why!

Jul 12, 2012 at 3:04 AM

OK, so the solution was to give the app pool account enough permissions to write to c:\windows\temp.

Jul 12, 2012 at 12:31 PM
From a security stand point, I don't think giving permissions to the c:\windows folder, or any of it's sub-folders, is good idea. Just my .02 worth


From: [email removed]
To: [email removed]
Date: Wed, 11 Jul 2012 20:04:24 -0700
Subject: Re: The handle is Invalid. IIS Windows Authentication Error. [EPPlus:362900]

From: Stewy
OK, so the solution was to give the app pool account enough permissions to write to c:\windows\temp.
Read the full discussion online.
To add a post to this discussion, reply to this email (EPPlus@discussions.codeplex.com)
To start a new discussion for this project, email EPPlus@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com