2

我们正在构建一个 C++/WWSAPI 客户端来连接第三方 C#/.net 服务器。我们有一个与服务器一起使用的示例 C#/.net 客户端。它的 App.config (client.exe.config) 中有这个:

<behaviors>
  <endpointBehaviors>
    <behavior name="TheirBehavior">
      <clientCredentials>
        <serviceCertificate>
          <defaultCertificate findValue="crypt.theirdomain.com" storeLocation="LocalMachine" storeName="Root" x509FindType="FindBySubjectName"/>
        </serviceCertificate>
      </clientCredentials>
    </behavior>
  </endpointBehaviors>
</behaviors>
<client>
  <endpoint address="https://zzz.theirdomain.com/TheirService.svc"
    binding="customBinding" bindingConfiguration="TheirServiceBinding" behaviorConfiguration="TheirBehavior"
    contract="ProdWS.ITheirService" name="TheirServiceBinding">
    <identity>
      <dns value="crypt.theirdomain.com"/>
    </identity>
  </endpoint>
</client>

我们还有一个证书,我们正在正确加载它(否则我们会There was an error when trying to find certificate '...'; Cannot find object or property.在调用之前得到。)

我们如何在 WWSAPI 中启用它?是否有任何参考可以显示所有 .net 配置设置和相应的 WWSAPI 配置之间的映射?

以下配置(在 中设置WS_SECURITY_BINDING)给出Invalid certificate credential specification in security binding.

WS_SSL_TRANSPORT_SECURITY_BINDING sslBind{};
sslBind.binding.bindingType = WS_SSL_TRANSPORT_SECURITY_BINDING_TYPE;
sslBind.localCertCredential = &certCred.credential;

这是在正确的轨道上吗?

4

1 回答 1

0

我们放弃了这种方法。但为了达到这一步,我们开始使用 Visual Studio 2015 的免费版本,并将我们的代码和库移植到 MSVC。

为了使其工作,我们创建了一个 C# .dll 项目并将其 .wsdl/.xsd 文件添加为“服务引用”,然后将该项目添加为对我们的 C++ 的引用。困难重重,包括必须手动将 .NET v4.5 破解到 .vcxproj 中,以及因此必须启用 /clr 并对库进行神秘修补。但让它工作。

我们的供应商声称“互操作性”是胡扯。只有 C#、Visual Studio 2015,就像他们正在使用的一样,然后将其连接到您自己的。

此外,Library.dll.config 文件需要重命名为可执行文件的 Executable.exe.config,否则 .NET 将找不到它。

于 2016-06-25T13:13:51.320 回答