J'ai développé l'application C# gui sur l'ordinateur serveur, et maintenant je veux l'exécuter depuis le client.Cet assembly n'autorise pas les appelants de confiance partielle
L'accès à l'application se fait via le répertoire mappé.
mais, quand je le lance, l'erreur suivante 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.
j'ai ajouté la ligne suivante dans Assembly.cs
[assembly: AllowPartiallyTrustedCallers]
mais il n'a pas aidé, et l'erreur est toujours là.
c'est dans le cadre dotnet 3.5.
pouvez-vous m'aider comment résoudre ce problème?
merci d'avance!
Par répertoire mappé, vous voulez dire un partage? .Net gère différemment un exe en matière de sécurité s'il s'exécute depuis un partage (ou net) ou depuis un lecteur local. – gerleim
J'ai trouvé un problème similaire vérifier: http://stackoverflow.com/questions/24468/running-partially-trusted-net-assemblies-from-a-network-share – gerleim
Voir ce pertinent [article MSDN] (http : //msdn.microsoft.com/en-us/library/8skskf63 (VS.71) .aspx). Essentiellement, vous rencontrez des problèmes d'accès à la sécurité du code. – mjv