SQL Server 2012, IIS 7.0, .Net 4.5
Everything is fine when I stream a document on my dev machine (IISExpress), but on the staging server I get
System.ComponentModel.Win32Exception (0x80004005): Access is denied
at System.Data.SqlTypes.SqlFileStream.OpenSqlFileStream(Stringpath, Byte[]transactionContext, FileAccessaccess, FileOptionsoptions, Int64allocationSize)
at System.Data.SqlTypes.SqlFileStream..ctor(Stringpath, Byte[]transactionContext, FileAccessaccess, FileOptionsoptions, Int64allocationSize)
Kerberos with delegation is set up between the staging IIS and SQL Server, database queries work fine on the staging server and integrated security works - I can see in sql profiler that I am getting to the sql server with my Active Directory credentials and I am set up as sysadmin for now. So I am wondering, what could possibly go wrong with the filestream access:
- Sql server and my account are set up fine, otherwise it would not work on my dev machine
- The staging server uses a valid conection to the sql server, otherwise I would not see my NT user name in profiler
- It can not be a two hop problem, since the same error pops up when I request the page from IE running on the staging server
- My C# code is very likely not the problem source, since I tried an additional coding example from MSDN and I am getting the same security exception with that (but the MSDN code also works on my dev machine)
I read a number of similar questions in the forums but typically an sql server login was the problem (which is not used in my scenario), and many such questions stayed unanswered. I also read that NTFS permissioning could be the problem but I don't think so since only the sql server service account needs access to the files (which it has, otherwise I would never be able to upload and download files).