如何创建此自定义绑定的 nettcp 绑定
我是 WCF 编程模型的新手,我想使用 netTcpBinding
。在我问下面的问题之前,这是我的自定义绑定:
<customBinding>
<binding name="basic">
<security authenticationMode="UserNameForCertificate"/>
<binaryMessageEncoding/>
<httpsTransport/>
</binding>
</customBinding>
当我使用简单的控制台应用程序创建服务引用时,它会找到一个证书并要求我使用它。这样我就可以使用网络服务...
但是当我使用 TransportWithMessageCredential
更改与 netTcpBinding
的绑定时,服务正在寻找证书,但找不到它,如下所示
<netTcpBinding>
<binding name ="sdfsd">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName"/>
<transport clientCredentialType="None"/>
</security>
</binding>
</netTcpBinding>
ServiceCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindByIssuerName, "Contoso.com").
:我使用 CustomNameValidator
并以编程方式执行此操作。
那么,当我将 netTcpBinding
与 TransportWithMessageCredential
结合使用时,为什么调用 SetCertificate
找不到已安装的证书?我错过了什么吗?或者我必须添加一些东西?
I am new at WCF programming model and I want to use netTcpBinding
. Before I ask my question below this is my custom binding :
<customBinding>
<binding name="basic">
<security authenticationMode="UserNameForCertificate"/>
<binaryMessageEncoding/>
<httpsTransport/>
</binding>
</customBinding>
When I create a service reference using a simple console application it finds a certificate and ask me to use it. And this way I can use the webservice ...
But when I change binding to netTcpBinding
with TransportWithMessageCredential
the service is looking for certificate and could not find it like this :
<netTcpBinding>
<binding name ="sdfsd">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName"/>
<transport clientCredentialType="None"/>
</security>
</binding>
</netTcpBinding>
ServiceCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindByIssuerName, "Contoso.com").
At this point I use a CustomNameValidator
and I do it programmatically.
So when I use netTcpBinding
with TransportWithMessageCredential
, why does the call to SetCertificate
not find the installed certificate? Am I missing something ? Or do I have to add something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,伙计们……抱歉,但有些信息是错误的……
我的自定义绑定是
customBinding和 netTcpBing 是:
我尝试转换的
ok guys...sorry but some of the message is miising ...
my custom binding is
customBinding
and netTcpBing that i tried to convert is :