I have an ASP.NET website. I want to upload a file to the website and save it into a FileTable in SqlServer 2012.
Once uploaded, my website code has a Stream object
This is a permissions problem. However, the permissions are not granted through NTFS but through SQL Server.
The Application Pool Identity does not have any permissions on your database by default so this has to be changed.
Add a Login to SQL Server for the Application Pool Identity you are using for your website. E.g. "IIS APPPool\MyAppPool"
USE [master] GO CREATE LOGIN [IIS APPPOOL\myapppoolname] FROM WINDOWS WITH DEFAULT_DATABASE=[MyDatabase] GO
Add a User to your database that this login will use
USE [MyDatabase] CREATE USER [MyUserName] FOR LOGIN [IIS APPPool\myapppoolname]
Grant the user relevant permissions on your database
use [MyDatabase] GRANT INSERT TO [MyUserName] GRANT SELECT TO [MyUserName] GRANT UPDATE TO [MyUserName]
I'm not sure if this is the complete set of permissions required but I found it was sufficient for me to be able to save a new file.