CLR Strore Procedure to access fixed Disk info

  • I am trying to write a CLR stored procedure to access the driveinfo object in IO. The code works fine from an external program, it just returns all the relevant info about all the drives mapped to the server.

    When I try to make the code into a stored proc I get a security exception. I have made the database "Trustworthy" and have set the assembly to have a permission level of external in VS2008, the proc deploys fine but will not run in SQL without getting an exception thrown.

    I realize that I could sign the assembly but I am just exploring other options, has anybody any advise on how you set the permissions for external access to a user, I have found a few references to extra permissions but nothing to say how you add those permissions?

    Any help would be appreciated.

  • Just to answer my own post - I found the solution was to set the permission level to unsafe in VS2008 project properties database tab. This adds the assembley with create assembly with permission_set=unsafe. Bit puzzling actually cos the DriveInfo object is in the System.IO namespace which is in the mscorlib assembly, that is supposed to be supported by default by SQL server?

Viewing 2 posts - 1 through 1 (of 1 total)

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