c# - WWSAPI 等效于 App.config 中的 C#/.net <serviceCertificate>

标签 c# .net soap soap-client wwsapi

我们正在构建一个 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 中设置)给出了安全绑定(bind)中的无效证书凭据规范。:

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

这是在正确的轨道上吗?

最佳答案

我们放弃了这种方法。但即便如此,我们也开始使用免费版 Visual Studio 2015,并将我们的代码和库移植到 MSVC。

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

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

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

关于c# - WWSAPI 等效于 App.config 中的 C#/.net <serviceCertificate>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37944063/

相关文章:

c# - 虽然循环无法按预期从列表中随机选择新字符串

c# - 为什么 VisualTreeHelper.GetChildrenCount() 为 Popup 返回 0?

c# - 我的 Xamarin.Android 应用有时会在启动时崩溃

c# - 作为配置属性的不可变类型

web-services - 访问 Delphi SOAP 服务器中的原始 TWebRequest 对象

c# - 在 Unity 中一般根据分数分配正确的 Sprite

c# - 使用 LINQ 而不是使用 for-each 循环

C# 反射 : replace all occurrence of property with value in text

php - 如何停止 PHP SoapClient 转换 s1 :char arguments to 0 or 1 in request

javax.xml.soap.SOAPException : java. security.ProviderException:无法派生 key