【发布时间】:2011-01-19 11:09:14
【问题描述】:
我正在使用 WCF 与多个服务器进行通信。
对于我的本地服务器 netTcpBinding 工作正常,没有问题。
但是当我尝试使用app.config 中的以下 netTcpBinding 连接到我的远程服务器 (Azure) 时,这将导致应用程序在初始化时崩溃,因为在没有完全信任的情况下无法创建 netTcpBinding。
app.config 文件中的此绑定,
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288"
maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Transport">
<transport clientCredentialType="None" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
会导致这个错误:
为“system.serviceModel/bindings”创建配置节处理程序时出错:该程序集不允许部分受信任的调用方。 (K:\Somepath\Testing.exe.Config 第 6 行)
奇怪的是:在app.config 文件中,我得到了连接到其他 netTcpBindings 的客户端端点(没有在绑定部分明确声明它们)。
为什么这些通用的 netTcpBindings 可以在部分信任下工作,而我上面展示的那个却不行?
或者我只是被这个错误信息弄糊涂了,问题不在于完全信任?
更新:如果我删除
【问题讨论】:
标签: wcf nettcpbinding