简体   繁体   English

WWSAPI等效于C#/。net <serviceCertificate> 在App.config中

[英]WWSAPI equivalent of C#/.net <serviceCertificate> in App.config

We're building a C++/WWSAPI client to connect with a third-party C#/.net server. 我们正在构建一个C ++ / WWSAPI客户端,以与第三方C#/。net服务器连接。 We have a sample C#/.net client that works with the server. 我们有一个与服务器一起使用的示例C#/。net客户端。 It has this in it's App.config (client.exe.config): 它的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>

We also have a certificate, which we're loading properly (otherwise we get There was an error when trying to find certificate '...'; Cannot find object or property. before the call.) 我们还有一个证书,正在正确加载(否则,我们会There was an error when trying to find certificate '...'; Cannot find object or property.在调用之前There was an error when trying to find certificate '...'; Cannot find object or property. 。)

How do we enable this in WWSAPI? 我们如何在WWSAPI中启用它? Is there any reference that will show mappings between all .net configuration settings and the corresponding WWSAPI configuration? 是否有任何参考资料显示所有.net配置设置与相应的WWSAPI配置之间的映射?

The following configuration (set in WS_SECURITY_BINDING ) gives Invalid certificate credential specification in security binding. 以下配置(在WS_SECURITY_BINDING设置) Invalid certificate credential specification in 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;

Is this on the right track? 这是在正确的轨道上吗?

We abandoned this approach. 我们放弃了这种方法。 But to even get this far, we started using the free version of Visual Studio 2015 and ported our code and libraries to MSVC. 但是,为了达到目标,我们开始使用免费版本的Visual Studio 2015,并将我们的代码和库移植到MSVC。

To make it work, we created a C# .dll project and added their .wsdl/.xsd files as a "Service Reference", then added that project as a Reference to our C++ one. 为了使其正常工作,我们创建了一个C#.dll项目,并将其.wsdl / .xsd文件添加为“服务引用”,然后将该项目添加为对C ++的引用。 Fraught with difficulties, including having to hack .NET v4.5 into the .vcxproj by hand, and having to enable /clr and do a mysterious patch to a lib because of it. 困难重重,包括必须手动将.NET v4.5入侵.vcxproj,并且必须启用/ clr并对其进行神秘的补丁。 But got it working. 但是让它工作了。

Our vendor's claim of "interoperability" was baloney. 我们的供应商对“互操作性”的主张是愚蠢的。 Only C#, Visual Studio 2015, just exactly like they're using, then bridge that to your own. 就像使用C#,Visual Studio 2015一样,然后将其桥接到您自己的。

Also, the Library.dll.config file needs to be renamed to the executable's Executable.exe.config, or .NET won't find it. 另外,Library.dll.config文件需要重命名为可执行文件的Executable.exe.config,否则.NET找不到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM