2016-06-21 23 views
2

我們正在構建一個C++/WWSAPI客戶端以連接第三方C#/。net服務器。我們有一個與服務器一起工作的示例C#/ .net客戶端。它有這個在它的App.config中(client.exe.config):與App.config中的C#/。net <serviceCertificate>等效的WWSAPI

<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; 

這是在正確的軌道上?

回答

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將無法找到它。