简体   繁体   English

该程序集不允许部分受信任的呼叫者

[英]That assembly does not allow partially trusted callers

i have developed c# gui application on server computer, and now i want to run it from client. 我已经在服务器计算机上开发了c#gui应用程序,现在我想从客户端运行它。

access to aplication is via mapped directory. 通过映射目录访问应用程序。

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.

i did added next line in Assembly.cs 我确实在Assembly.cs中添加了下一行

[assembly: AllowPartiallyTrustedCallers]

but it did not help, and error is still there. 但这并没有帮助,错误仍然存​​在。

it's in dotnet 3.5 framework. 它在dotnet 3.5框架中。

can you help me how to solve this problem? 您能帮我解决这个问题吗?

thank you in advance! 先感谢您!

aha i did it!!! 啊哈,我做到了!!!

you have to run .... 你必须跑....

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

from client machine, not from server! 从客户端计算机,而不是从服务器!

It is not your assembly which has to be marked with this attribute, it is the assembly you are calling. 不是您的程序集必须使用此属性标记,而是您正在调用的程序集。

Essentially this exception is telling you that the assembly you are calling does not allow strangers to call it. 本质上,此异常告诉您正在调用的程序集不允许陌生人调用它。 And your assembly is a stranger. 而且您的程序集是一个陌生人。 To make it not a stranger you need to to grant it full trust, or apply the AllowPartialCallers attribute to the referenced assembly (if it is your assembly) 为了使其不再陌生,您需要授予它完全信任,或将AllowPartialCallers属性应用于引用的程序集(如果它是您的程序集)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 部署时“该程序集不允许部分受信任的呼叫者” - “That assembly does not allow partially trusted callers” on deployment SecurityException:该程序集不允许部分受信任的调用方 - SecurityException: That assembly does not allow partially trusted callers 该程序集不允许部分受信任的呼叫者,尽管该区域是完全受信任的 - That assembly does not allow partially trusted callers although the zone is fully trusted C#-.NET 4.0-该程序集不允许部分受信任的调用方 - C# - .NET 4.0 - That Assembly does not allow partially trusted callers 该程序集不允许部分信任的调用者。 的InitializeComponent() - That assembly does not allow partially trusted callers. InitializeComponent() System.Security.SecurityException:该程序集不允许部分信任的调用者 - System.Security.SecurityException: That assembly does not allow partially trusted callers System.Security.SecurityException:该程序集不允许部分信任的调用者 - System.Security.SecurityException: That assembly does not allow partially trusted callers 使用自定义解析器时,程序集不允许部分受信任的调用者 - Assembly does not allow partially trusted callers when using a custom resolver Unity配置错误-该程序集不允许部分受信任的调用者 - Unity configuration error - That assembly does not allow partially trusted callers 程序集不允许部分受信任的调用者 - Assembly does not allow partially trusted caller
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM