.NET assembly runs in partial trust on a network drive, but all other in full trust

前端 未结 3 787
执笔经年
执笔经年 2020-12-04 02:59

We have a strange issue with our C++ solution (which calls .NET 4.0 assemblies) when running on a network drive. The solution hosts several WCF services with NetTcpBinding,

相关标签:
3条回答
  • 2020-12-04 03:10

    Right click on app.config -> Properties -> Unbock

    0 讨论(0)
  • 2020-12-04 03:24

    It's called code access security (CAS), and it forces all untrusted network drives to be treated as untrusted network code.

    Local code has full trust, network code has partial trust and Internet code has no trust. It's a .NET only security model. Your options are to either designate the network drive as a 'trusted' drive by giving it full rights (search for caspol.exe full trust network drive) or to copy the EXE file to a local drive.

    Using CASPOL to Fully Trust a Network Share should help you out.

    Or on the command line:

    CasPol.exe -m -pp off -ag 1.2 -url file://///server/share/* FullTrust .
    
    0 讨论(0)
  • 2020-12-04 03:28

    We didn't find a solution here but a workaround: Don't use the app.config for the binding settings. Setting them in code works for us in the same environment.

    This question by the way seems to handle a similar issue. HTH

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