Tuesday, March 27, 2012

error executing assemblie

hellow i execute assemblie in sql server, assemblie opens up file and writes some information, when i run that esemblie i get the follwing message

An error occured: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

thanks for any ideas

i found solution myself

solution is tu make your assemblie to have external access, but now other error occured when the assemblie is trying to write to file

An error occured: Access to the path 'C:\log.txt' is denied.

(1 row(s) affected)

|||When SQL Server executes something that goes outside of SQL (i.e file access), it does that under the security context of the account SQL runs under. It might be that, that account does not have sufficient permissions for that file.

If that's the case you can (if the original caller uses integrated security) do a impersonation, by using SqlContext.WindowsIdentity.

Niels

No comments:

Post a Comment