Filestream Access Denied

  • I'm experimenting with the FILESTREAM capability of 2008 and have set up a working example table which I can add records to via straight SQL using, for example, CAST('Sample document' AS VARBINARY(MAX)) on an insert. However, when trying to use the SqlFileStream object from a .NET app, I get a generic Access Denied exception when I try to write a file. (Yeah, this could be a .NET issue rather than a SQL server specific one, but since it's an access rights issue I'm inclined to check the server side first.)

    I insert a dummy record, retrieve a path and transaction context, and then call:

    Dim fs As New SqlTypes.SqlFileStream(path, txCtx, FileAccess.Write)

    - at which point I get the error.

    I'm connecting with integrated security, logged onto the same domain account that created the database and has admin access to the server, and can successfully insert dummy records with SQL from either the client or server with this account.

    Any suggestions what to look for here?

  • Two things I know of to check:

    1) Server properties - make sure you have set filestream access to full access

    2) You must be using Windows Authentication to access the fileshare.

    Other than that - I don't have any other suggestions.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • Using windows authentication and FileStream ConfiguredLevel and EffectiveLevel are both at 2.

  • Have you turned on auditing on the folders and seen if that produces an issue?

    Are you able to access, open and write to the file outside of sql using the account?



    Shamless self promotion - read my blog http://sirsql.net

  • Yes, I can edit & save at the filesystem level when remoted into the server.

    I've turned on auditing to catch inserts into the table in question, but the logs are empty (presumably because the transaction always gets rolled back when the SqlFileStream call fails). I'm not terribly familiar with the audit feature - how can specifically trace attempts to write to the filestream?

  • Update: I turned on Win Server file auditing for Everyone for the directory where the filestream resides and found that the file is accessed successfully being accessed by the SQLServer process at the time of creation of the record (with a bit of dummy text cast as varbinary(MAX) as a placeholder) , but there seems to be no attempt at file access when then SqlfileStream routine is called.

  • I think I know your problem I just got those weird error so you need to go to configuration manager and configure Filestream and also make sure the account for SQL Server service is local system change it in properties. Then go to management studio and go to server properties go to advanced and you will see it is still disabled make sure you enable it. I also restarted the box not just SQL Server service. The reason is it is the account used by SQL Server service that runs this thing so you need a higher account than Network Service.

    Kind regards,
    Gift Peddie

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply