Running “partially trusted” .NET assemblies from a network share

后端 未结 4 760
执念已碎
执念已碎 2021-01-11 14:37

When I try to run a .NET assembly (boo.exe) from a network share (mapped to a drive), it fails since it\'s only partially trusted:

Unhandled Exc         


        
相关标签:
4条回答
  • 2021-01-11 15:19

    I resolved the problem by using caspol as instructed in Johnny Hughes' blog post Running a .Net application from a network share:

    caspol -addgroup 1.2 -url file:///H:/* FullTrust
    

    It seems the .NET Configuration GUI for managing the policies simply doesn't work.

    0 讨论(0)
  • 2021-01-11 15:28

    Take a look at the 'caspol.exe' program (provided with .NET runtimes). You will have to do this on the machine you are trying to run the application from. I wasn't able to 'mark' and assembly (probably just me). However, using caspol and setting up the proper permission for my app, LocalIntranet_Zone, fix my similar issue.

    I have heard (but haven't tried it yet), that .NET 3.5 sp1 removed this tighten security requirement (not allowing .NET assemblies to reside on a share by default).

    0 讨论(0)
  • 2021-01-11 15:29

    With .NET 3.5 SP1, .NET assemblies running from UNC shares have full permissions.

    See Brad Abrams's Allow .exes to be run off a network shares for workaround and discussions, and finally the follow up .NET 3.5 SP1 allows managed code to be launched from a network share.

    0 讨论(0)
  • 2021-01-11 15:29

    I think you want to add the AllowPartiallyTrustedCallers attribute to your assembly. The error message implies that something that's calling into your boo.exe assembly is not fully trusted, and boo.exe doesn't have this attribute allowing it.

    0 讨论(0)
提交回复
热议问题