Request for the permission of type 'System.Data.SqlClient.SqlClientPermission failed

后端 未结 3 1952
既然无缘
既然无缘 2021-01-21 22:50

I have an ASP.NET application, using LINQ to connec to a SQL Server 2008 R2 databse.

My connection string:

Data Source=[SqlServerIp];Initial Catalog=[dat         


        
3条回答
  •  佛祖请我去吃肉
    2021-01-21 23:36

    The security context under which your ASP.net application is running does not have permissions to load that sql client assembly. The out of the box context, ASPNET, does, so there's problem been some custom configuration that has broken it...it's difficult to say what without being able to look at the box.

    But the bottom line is that the security context of the application doesn't have perms to that assembly. The following steps should get you working:

    1. Write a page that outputs the security context of the application:

    Response.Write(System.Security.Principal.Current().WindowsIdentity.Name);

    1. Add the user named on that page to the administrators group. This should allow the assembly to load.

    2. Reduce the permissions of the specified user to a minimum downward from administrator.

提交回复
热议问题