2012-04-23 96 views
1

我只有xml配置文件和.exe(所以不是完整的解決方案)的WCF服務。我可以通過https使現有終端安全嗎? 如果是這樣,我該如何做到這一點,我怎樣才能連接到我的客戶端,將在網絡中的另一臺電腦上?只有XML配置文件的WCF服務上的SSL端點

這將是我服務的XML配置: 我結合:

<wsHttpBinding> 
    <binding 
     name="HighQuotaWSHttpBinding" 
     receiveTimeout="00:10:00" 
     sendTimeout="00:10:00" 
     bypassProxyOnLocal="true" 
     maxBufferPoolSize="2147483647" 
     useDefaultWebProxy="false" 
     maxReceivedMessageSize="2147483647"> 
     <security mode="Transport"> 
     <transport clientCredentialType="None" /> 
     </security> 
    </binding> 
    </wsHttpBinding> 

我的終點:

<service 
    behaviorConfiguration="WebDataServiceBehaviour" 
    name="Humiq.Integral.WebDataService.Impl.ServiceLayer.WcfLibrary.WebDataService"> 
    <endpoint 
     address="WebDataService" 
     binding="wsHttpBinding" bindingConfiguration="HighQuotaWSHttpBinding" 
     contract="Humiq.Integral.WebDataService.Intf.ServiceLayer.IWebDataService" 
     name="WebDataServiceHttpBinding"> 
     <identity> 
     <dns value="localhost" /> 
     </identity> 
    </endpoint> 
    <endpoint 
     address="mex" 
     binding="mexHttpsBinding" 
     contract="IMetadataExchange" 
     name="mexManagement" /> 
    <host> 
     <baseAddresses> 
     <add baseAddress="http://mylocalip:9650/" /> 
     <add baseAddress="https://mylocalip:9651/" /> 
     </baseAddresses> 
    </host> 
    </service> 

行爲:

<behaviors> 
    <serviceBehaviors> 
    <!-- Behavior for WebserviceData interface --> 
    <behavior name="WebDataServiceBehaviour"> 
     <!-- Set throttling of (concurrent) cals --> 
     <serviceThrottling 
     maxConcurrentCalls="100" 
     maxConcurrentSessions="100" 
     maxConcurrentInstances="100"/> 
     <!-- To avoid disclosing metadata information, 
     set the value below to false and remove the metadata endpoint above before deployment --> 
     <serviceMetadata httpsGetEnabled="True"/> 
     <!-- To receive exception details in faults for debugging purposes, 
     set the value below to true. Set to false before deployment 
     to avoid disclosing exception information --> 
     <serviceDebug includeExceptionDetailInFaults="True" /> 
     <dataContractSerializer maxItemsInObjectGraph="2147483646"/> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 

這是我的客戶:

<bindings> 
     <wsHttpBinding> 
      <binding name="WebDataServiceHttpBinding" closeTimeout="00:01:00" 
       openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
       bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
       maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 
       messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
       allowCookies="false"> 
       <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
        maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
       <reliableSession ordered="true" inactivityTimeout="00:10:00" 
        enabled="false" /> 
       <security mode="Transport"> 
        <transport clientCredentialType="Basic" proxyCredentialType="None" 
         realm="" /> 
        <message clientCredentialType="Windows" negotiateServiceCredential="true" /> 
       </security> 
      </binding> 
     </wsHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="https://mylocalip:9651/WebDataService" binding="wsHttpBinding" 
      bindingConfiguration="WebDataServiceHttpBinding" contract="wcf1.IWebDataService" 
      name="WebDataServiceHttpBinding"> 
      <identity> 
       <dns value="localhost" /> 
      </identity> 
     </endpoint> 
    </client> 
+0

的App.config或Web.Config中?如何託管? – 2012-04-23 11:44:46

+0

對不起,這是一個XML配置文件。它位於同一網絡上的一臺PC上。 – user1350954 2012-04-23 11:53:06

+0

這不能回答我的任何問題。 – 2012-04-23 11:54:56

回答

0

您需要定義在Windows上使用ssl的端口。

它使用netsh命令來完成,你可以閱讀它的幫助:

netsh http add sslcert ipport=0.0.0.0:8732 certhash=4745537760840034c3dea27f940a269b7d470114 appid={00112233-4455-6677-8899-AABBCCDDEEFF} 
+0

已經完成了這個 – user1350954 2012-04-24 06:55:42

+0

現在有什麼問題嗎?你能啓動服務嗎? – 2012-04-24 10:32:04

+0

是的我可以啓動服務控制檯說客戶端證書不提供 – user1350954 2012-04-24 11:04:09