申请类型的权限'System.Data.SqlClient.SqlClientPermission失败 [英] Request for the permission of type 'System.Data.SqlClient.SqlClientPermission failed

查看:940
本文介绍了申请类型的权限'System.Data.SqlClient.SqlClientPermission失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.NET应用程序,使用LINQ to CONNEC到SQL Server 2008 R2 DATABSE。

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

我的连接字符串:

Data Source=[SqlServerIp];Initial Catalog=[databaseName]User Id=newLogin;Password=newPassword;

当我部署我的本地IIS应用程序(这是不是在同一台计算机的数据库服务器),它工作正常,但是当我部署在其他IIS(在同一台计算机的SQL Server)应用程序,它抛出一个异常:

When I deploy the application on my local IIS (which is not the same machine as database server) it works fine, but when I deploy application on other IIS (the same machine as SQL Server) it throws an exception:

System.Security.SecurityException:申请类型的权限'System.Data.SqlClient.SqlClientPermission,System.Data这,版本= 2.0.0.0,文化=中性公钥= b77a5c561934e089'失败

System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

任何人都知道如何解决它?也许是由于IIS的一些不好的配置?

Anyone knows how to fix it? Maybe it is due to some bad configuration of IIS?

推荐答案

尝试运行在调试模式下一个Web服务时,我会得到这个错误。我发现,这是因为code是一个网络驱动器上(在我的情况下,我的文档是主驱动器上)。

I would get this error when trying to run a Web Service in debug mode. I found that it was because code was on a network drive (in my case my documents was on the home drive).

我建议检查该code在没有网络驱动器。

I would suggest checking that the code in not a network drive.

这篇关于申请类型的权限'System.Data.SqlClient.SqlClientPermission失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆