【发布时间】:2012-02-04 08:55:09
【问题描述】:
我有一个类库,它应该与现有的命名管道服务器建立连接。我得到的错误是:
在 ServiceModel 客户端配置部分中找不到名为“internal”和合同“SelectedStudentReference.ISelectedStudent”的端点元素。这可能是因为找不到您的应用程序的配置文件,或者因为在客户端元素中找不到与此名称匹配的端点元素。
这是来自 dll.config 的 xml:
<system.serviceModel>
<bindings>
<netNamedPipeBinding>
<binding name="internal" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false"
transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport protectionLevel="EncryptAndSign" />
</security>
</binding>
</netNamedPipeBinding>
</bindings>
<client>
<endpoint address="net.pipe://localhost/SelectedStudent" binding="netNamedPipeBinding"
bindingConfiguration="internal" contract="SelectedStudentReference.ISelectedStudent"
name="internal">
<identity>
<userPrincipalName value="name@company.org" />
</identity>
</endpoint>
</client>
</system.serviceModel>
这是我用来实例化客户端的代码,也是它引发错误的地方:
using AwardManager.SelectedStudentReference;
if (_client == null) _client = new SelectedStudentClient("internal");
我知道服务器正在运行,并且错误消息仅提及客户端故障。从类库中这样做有什么问题吗?安装程序没有将 .config 与 dll 一起复制出来,我是手动复制的,所以我不确定 .dll 是否关注 .config。
这是一个已注册的 COM 可见 dll,由另一个进程实例化和调用。我无法将此 system.serviceModel 添加到其他进程的 .config 中。
如果可行的话,我可以用代码构建客户端,并且我有一些如何实现的示例。
我还可以对 userPrincipleName 使用一些帮助。使用我的凭据似乎不正确。它不应该指定用户的凭据或一些通用凭据吗?它甚至需要包含在客户端配置中吗?
谢谢
【问题讨论】:
标签: wcf wcf-binding wcf-security wcf-client