沙箱 Web 部件中的 SqlClientPermission
我尝试了很长时间才能在我的 Web 部件中获得有效的 SQL 连接。我读了很多 msdn 的东西并尝试了很多东西,但我无法让它工作...每次我尝试打开 SQL 连接时,我的 Web 部件都会抛出异常:请求类型 ' 的权限System.Data.SqlClient.SqlClientPermission
。
我尝试了 custom.configs 来设置更高的 .net 信任,编辑清单,使用 PermissionSet-Class 设置权限,还尝试了 FullTrust,但没有任何效果。如何正确设置权限? 顺便说一句,Web 部件是一个沙箱解决方案。
如果有人能给我详细的视图,如何设置权限,那就太棒了。
I'm trying a long time to get a working SQL connection in my web part. I read a lot of msdn stuff and tried many things, but I can't get it working... Every time I try to open a SQL connection, my web part throw an exception: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission
.
I tried custom.configs which set the .net trust higher, edit the manifest, set the permissions with the PermissionSet-Class and also tried FullTrust, but nothing worked. How do I set the permission correctly?
Btw, the web part is a sandbox solution.
It would be awesome if someone could give me a detailed view, how to set the permissions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于这种操作,您需要开发一个完全信任的代理(SPProxyOperation)由您的沙盒解决方案使用。
沙箱解决方案具有代码访问安全性和权限限制。详细信息您可以访问:
http://extreme-sharepoint.com/2011/ 10/07/sharepoint-sandbox-reallly-new-feature/
For this kind of operation, You need to develop a full trust proxy(SPProxyOperation) to be used by your Sandbox Solutions.
The sandbox solutions has Code Access Security and Permission restrictions. For details you can visit:
http://extreme-sharepoint.com/2011/10/07/sharepoint-sandbox-reallly-new-feature/