巨难,谁能解决,400分奉上.绝不食言.

CTaoHero 2003-10-15 01:29:13
问题是这样的:
应用程序是从客户端浏览器中打开的,格式如: http://abcd/a.exe
我在.net的Framework中已经做了信任站点的设置.程序已经可以打开了.但是,程序中有这样的一项功能,就是将服务器上的某excel文件下载到客户端,并以引用的方式打开这个excel文件对其进行操作.(就是用Excel命名空间里的类对这个excel进行操作),现在文件已经可以下载回来了,(但是方法不是很好,如果哪位朋友有更好的方法请一并贴出来谢谢)但在引用
(注:
strPath为excel文件路径
workbook = excelfile.Workbooks.Open(strPath) )
这个excel文件时抛出异常,如下:

System.Security.SecurityException: 种类 System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 的访问许可的要求失败了。
at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet grantedSet, PermissionSet deniedSet, CodeAccessPermission demand, PermissionToken permToken)
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Excel.Range.set__Default(Object RowIndex, Object ColumnIndex, Object )
at WindowsApplication1.Form1.Button1_Click(Object sender, EventArgs e)

访问权限失败的原因如下 :
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="UnmanagedCode"/>

请问各位大侠,我该如何处理啊?我已经将Framework中的对这个服务器的权限设置成完全信任了.还应该设置哪里啊?
...全文
94 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
hiswing 2003-10-16
  • 打赏
  • 举报
回复
在这个贴子里我已经解决了这个问题,前来接分.呵呵http://expert.csdn.net/Expert/topic/2357/2357815.xml?temp=.5442011
freexin 2003-10-15
  • 打赏
  • 举报
回复
click on "View Permissions", you will see "Allows Calls to Unmanaged Code" is not granted

学习@
saucer 2003-10-15
  • 打赏
  • 举报
回复
check the security

1. on the client machine, go to Control Panel->Administrative Tools
2. run Microsoft .NET Framework Configuration
3. Runtime Security Policy->Machine->Code Group->All_Code-> select Trusted_Zone
4. on the right side, click on "Edit Code Group Properties", go to Permission Set tab, select the right Permission Set in the dropdownlist, then, select "Security" in the list, click on "View Permissions", you will see "Allows Calls to Unmanaged Code" is not granted


to modify the security, right click on Runtime Security Policy node and select "Adjust Security...", following the instructions....
rgbcn 2003-10-15
  • 打赏
  • 举报
回复
gz
xinyu_1980 2003-10-15
  • 打赏
  • 举报
回复
关注
lbzq 2003-10-15
  • 打赏
  • 举报
回复
"分布式COM配置"做了么?
xingxinglzg 2003-10-15
  • 打赏
  • 举报
回复
关注,帮顶
aukawa 2003-10-15
  • 打赏
  • 举报
回复
关注,学习,up
CTaoHero 2003-10-15
  • 打赏
  • 举报
回复
没人关注吗?

62,041

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧