该程序集不允许部分受信任的调用方

编程入门 行业动态 更新时间:2024-10-25 06:22:27
本文介绍了该程序集不允许部分受信任的调用方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经开发了C服务器计算机上#GUI应用程序,现在我想从客户端运行它。

i have developed c# gui application on server computer, and now i want to run it from client.

进入aplication是通过映射目录。

access to aplication is via mapped directory.

但是,当我运行它,下一个错误occure:

but, when i run it, next error occure:

> See the end of this message for > details on invoking just-in-time > (JIT) debugging instead of this dialog > box. > > ************** Exception Text ************** System.Security.SecurityException: > That assembly does not allow partially > trusted callers. at > System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly > asm, PermissionSet granted, > PermissionSet refused, > RuntimeMethodHandle rmh, > SecurityAction action, Object demand, > IPermission permThatFailed) at > Yobs01.Form1.button1_Click(Object > sender, EventArgs e) at > System.Windows.Forms.Control.OnClick(EventArgs > e) at > System.Windows.Forms.Button.OnClick(EventArgs > e) at > System.Windows.Forms.Button.OnMouseUp(MouseEventArgs > mevent) at > System.Windows.Forms.Control.WmMouseUp(Message& > m, MouseButtons button, Int32 clicks) > at > System.Windows.Forms.Control.WndProc(Message& > m) at > System.Windows.Forms.ButtonBase.WndProc(Message& > m) at > System.Windows.Forms.Button.WndProc(Message& > m) at > System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& > m) at > System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& > m) at > System.Windows.Forms.NativeWindow.Callback(IntPtr > hWnd, Int32 msg, IntPtr wparam, IntPtr > lparam) The action that failed was: > LinkDemand The Zone of the assembly > that failed was: Intranet > > > ************** Loaded Assemblies ************** mscorlib > Assembly Version: 2.0.0.0 > Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400) > CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll > ---------------------------------------- Yobs01 > Assembly Version: 1.0.0.0 > Win32 Version: 1.0.0.0 > CodeBase: file:///Z:/Debug/Yobs01.exe > ---------------------------------------- System.Windows.Forms > Assembly Version: 2.0.0.0 > Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400) > CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll > ---------------------------------------- System > Assembly Version: 2.0.0.0 > Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400) > CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll > ---------------------------------------- System.Drawing > Assembly Version: 2.0.0.0 > Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400) > CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll > ---------------------------------------- System.Data.SqlServerCe > Assembly Version: 3.5.1.0 > Win32 Version: 3.5.5692.0 > CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Data.SqlServerCe/3.5.1.0__89845dcd8080cc91/System.Data.SqlServerCe.dll > ---------------------------------------- System.Data > Assembly Version: 2.0.0.0 > Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400) > CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll > ---------------------------------------- System.Transactions > Assembly Version: 2.0.0.0 > Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400) > CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll > ---------------------------------------- > > ************** JIT Debugging ************** To enable just-in-time (JIT) debugging, the .config file for > this application or computer > (machine.config) must have the > jitDebugging value set in the > system.windows.forms section. The > application must also be compiled with > debugging enabled. > > For example: > > <configuration> > <system.windows.forms jitDebugging="true" /> > </configuration> > > When JIT debugging is enabled, any > unhandled exception will be sent to > the JIT debugger registered on the > computer rather than be handled by > this dialog box.

我没有加入下一行Assembly.cs

i did added next line in Assembly.cs

[assembly: AllowPartiallyTrustedCallers]

但它并没有帮助,而且依然出现。

but it did not help, and error is still there.

它在DOTNET 3.5框架。

it's in dotnet 3.5 framework.

您能帮助我如何解决这个问题?

can you help me how to solve this problem?

感谢你在前进!

推荐答案

AHA我做到了!

您必须运行....

caspol -m -ag 1 -url   文件:// \服务器\ MYDIR *FullTrust的   -Exclusive对

caspol -m -ag 1 -url "file://\server\mydir*" FullTrust -exclusive on

这是客户机,而不是从服务器!

from client machine, not from server!

更多推荐

该程序集不允许部分受信任的调用方

本文发布于:2023-11-05 08:37:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1560379.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不允许   程序

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!