Windows 安全性是否隐藏了 .NET 类的某些方法?
我在 Windows Server 2008 下工作:S 受限制的用户不是管理员。 使用 Visual Studio 2010
我尝试运行编写此代码
ApplicationClass app = new ApplicationClass();
Workbook book = app.Workbooks.Open("");
Worksheet sheet = (Worksheet)book.Worksheets[1];
Picture pict = sheet.Pictures(pictureName) as Picture;
Pictures() 方法在 sheet 对象中不存在!
但是
当我在 Windows 7 下使用管理员用户尝试此代码时 Picture() 方法存在,一切正常
我想知道,是否有一些与互操作和 Windows 安全有关的东西?
I'm working under windows Server 2008 :S
with restricted user not administrator.
using Visual Studio 2010
I try to run write this code
ApplicationClass app = new ApplicationClass();
Workbook book = app.Workbooks.Open("");
Worksheet sheet = (Worksheet)book.Worksheets[1];
Picture pict = sheet.Pictures(pictureName) as Picture;
Pictures() method not exist in sheet object !
But
When I try this code under windows 7 with Administrator user
The Picture() method is exist and every thing is OK
I wonder, if there is some thing with interop and windows security ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您为此访问 MSDN 页面,我可以看到两个问题:
http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.worksheet.pictures.aspx
此 API 支持 Visual Studio 基础结构和无意直接从您的代码中使用。
对直接呼叫者的完全信任。该成员不能被部分信任的代码使用。有关详细信息,请参阅使用部分受信任代码中的库。
看来确实是用户受限的原因。您使用此 API 是否有原因,因为文档表明不应直接使用它?也许你缺少一个包装纸。
If you visit the MSDN page for this, I can see two issues:
http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.worksheet.pictures.aspx
This API supports the Visual Studio infrastructure and is not intended to be used directly from your code.
Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
It seems the reason is indeed a restricted user. Is there a reason you are using this API since documentation suggests that it should not be used directly. Perhaps you are missing a wrapper.