Microsoft
Software
Hardware
Network
Question : CLR Stored Procedure
the .net sql stored procedure tries to create a file on the server:
error:
Msg 6522, Level 16, State 1, Procedure ZIP, Line 0
A .NET Framework error occurred during execution of user-defined routine or aggregate "ZIP":
System.ArgumentException: exception: {0}
Parameter name: System.UnauthorizedAccessE
xception: Access to the path 'C:\' is denied.
at System.IO.__Error.WinIOErr
or(Int32 errorCode, String maybeFullPath)
Code:
EXEC sp_configure @configname = 'Show Advanced Options', @configvalue = 1
RECONFIGURE WITH OVERRIDE
GO
EXEC sp_configure @configname = 'clr enabled', @configvalue = 1
RECONFIGURE WITH OVERRIDE
GO
drop assembly ZipStorer
ALTER DATABASE UTIL SET TRUSTWORTHY ON
create ASSEMBLY ZipStorer from 'C:\ZipStorer.dll'
WITH PERMISSION_SET = UNSAFE
DROP ASSEMBLY PMA
ALTER DATABASE UTIL SET TRUSTWORTHY ON
create ASSEMBLY PMA from 'C:\StoredProcedureZip.dll
'
WITH PERMISSION_SET = UNSAFE
ALTER DATABASE UTIL SET TRUSTWORTHY ON
GO
Drop PRocedure zip
go
CREATE PROCEDURE ZIP
@SourcefilePath nvarchar,
@DestinationFilePath nvarchar,
@EveryFile bit
WITH EXECUTE AS OWNER
AS
EXTERNAL NAME PMA.[StoredProcedureZip.PM
A.Zip].Com
press
exec UTIL.dbo.ZIP 'C:\test zip\','c:\test.zip',1
Answer : CLR Stored Procedure
Check that account under which you are running your SP has access to C:\
Random Solutions
How to get Full XML node name using C#
CRM 4.0: issues pre-populating a Currency lookup and money field ("A currency is required if a value exists in a money field")
Logout Button for <asp:LoginStatus> not working
Error Loading sshnas.dll
Small business server 2008 unable to add user with console
How do I close Adobe Reader from within VB.NET
Guides On Data Access Pages
In VFP how can you locate what windows users have use of a table or exclusive use of the table
Can i modify uptime of machine?
Defining anamed range dunamically