如何创建此自定义绑定的 nettcp 绑定

发布于 2024-09-05 06:23:05 字数 1208 浏览 5 评论 0原文

我是 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 并以编程方式执行此操作。

那么,当我将 netTcpBindingTransportWithMessageCredential 结合使用时,为什么调用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

中二柚 2024-09-12 06:23:05

好吧,伙计们……抱歉,但有些信息是错误的……
我的自定义绑定是
customBinding和 netTcpBing 是:

<customBinding>
    <binding name="basic">
      <security authenticationMode="UserNameForCertificate"/>
      <binaryMessageEncoding/>
      <httpsTransport/>
    </binding>
  </customBinding>

我尝试转换的

   <netTcpBinding>
    <binding name ="sdfsd">
      <security mode="TransportWithMessageCredential">
        <message clientCredentialType="UserName"/>
        <transport clientCredentialType="None"/>
      </security>

    </binding>
  </netTcpBinding>

ok guys...sorry but some of the message is miising ...
my custom binding is
customBinding

<customBinding>
    <binding name="basic">
      <security authenticationMode="UserNameForCertificate"/>
      <binaryMessageEncoding/>
      <httpsTransport/>
    </binding>
  </customBinding>

and netTcpBing that i tried to convert is :

   <netTcpBinding>
    <binding name ="sdfsd">
      <security mode="TransportWithMessageCredential">
        <message clientCredentialType="UserName"/>
        <transport clientCredentialType="None"/>
      </security>

    </binding>
  </netTcpBinding>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文