System.Security.SecurityException:请求失败

本文关键字:请求 失败 SecurityException Security System | 更新日期: 2023-09-27 17:57:27

Hi-am尝试使用CLR集成从sql server访问外部exe。

我设置了数据库TRUSTWORTHY ONPERMISSION_SET = EXTERNAL_ACCESS,但收到以下错误

Msg 6522, Level 16, State 1, Procedure hello, Line 0
A .NET Framework error occurred during execution of user defined routine or aggregate 'hello': 
System.Security.SecurityException: Request failed.
System.Security.SecurityException: 
   at HelloWorldProc.HelloWorld()

helloworld.cs代码:

using System;
using System.Data;
using Microsoft.SqlServer.Server;
using System.Data.SqlTypes;
using System.Diagnostics;
public class HelloWorldProc
{
    [Microsoft.SqlServer.Server.SqlProcedure]
    public static void HelloWorld()
    {
        SqlContext.Pipe.Send("Hello world!'n");
        Process.Start(@"D:'Raja'trg.exe");
}
}

System.Security.SecurityException:请求失败

我得到了这个错误的解决方案,我们想在administrator中设置SQL Server服务登录。

控制面板->管理工具->服务

查找MSSQLServer服务将其"登录方式"从本地系统更改为"管理员"

现在我可以通过SQL Server过程打开单词doc了。