.NET 程序集在网络驱动器上以部分信任的方式运行,但所有其他程序以完全信任的方式运行 [英] .NET assembly runs in partial trust on a network drive, but all other in full trust
问题描述
在网络驱动器上运行时,我们的 C++ 解决方案(调用 .NET 4.0 程序集)有一个奇怪的问题.该解决方案使用 NetTcpBinding 承载多个 WCF 服务,其中之一具有非默认绑定配置.在部分信任下,非默认 NetTcpBinding 本身是不可能的(参见堆栈溢出问题 WCF NetTcpBinding 何时需要完全信任客户端?),但该解决方案在完全信任的网络驱动器下运行.这确实适用于多台不同的计算机(Windows Vista 和 Windows 7),但在一台(Windows Vista)上失败并引发异常,
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, one of them with a non-default binding configuration. A non-default NetTcpBinding is per se not possible under partial trust (see Stack Overflow question When does WCF NetTcpBinding need full trust on the client?), but the solution runs under a fully trusted network drive. This does work on several different computers (Windows Vista and Windows 7) but fails on one (Windows Vista) with throwing an exception,
为system.serviceModel/bindings"创建配置节处理程序时出错:该程序集不允许部分受信任的调用者.(K:SomepathTesting.exe.Config 第 6 行)
An error occurred creating the configuration section handler for "system.serviceModel/bindings": That assembly does not allow partially trusted callers. (K:SomepathTesting.exe.Config line 6)
如果该解决方案确实在该计算机上的部分信任下运行,但它确实在完全信任下运行,则此异常完全可以.即使我检查了对代码的完全信任,它也是如此.
This exception would be totaly OK, if the solution would indeed run under partial trust on that computer, but it does run under full trust. Even if I check for full trust in code it is true.
我们用它运行的其中一台计算机仔细检查了 Internet 选项 - 没有区别.
We double checked the Internet options with one of the computers it works on - no differences.
所有的 DLL 文件和 EXE 文件都是强命名的.
All DLL files and the EXE file are strong named.
更新:网络驱动器完全信任特定计算机 (caspol.exe
).
Update:
The network drive is under full trust on the particular computer (caspol.exe
).
我们应该寻找什么?
如果您需要更多信息,请告诉我.
If you need additional information, please let me know.
更新 2:我们仍然有这个问题,现在甚至在一台计算机上(Windows 7).所以它似乎是独立于操作系统的.
Update 2: We still have that issue and now even on one computer more (Windows 7). So it seems to be OS independent.
推荐答案
我们在这里没有找到解决方案,但有一个解决方法:不要使用 app.config 进行绑定设置.在相同的环境中,在代码中设置它们对我们有用.
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
这篇关于.NET 程序集在网络驱动器上以部分信任的方式运行,但所有其他程序以完全信任的方式运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!