【问题标题】:SSL endpoint on a WCF service with only XML configuration file仅具有 XML 配置文件的 WCF 服务上的 SSL 端点
【发布时间】:2012-04-24 05:01:15
【问题描述】:

我有一个只有 xml 配置文件和 .exe 的 WCF 服务(所以不是完整的解决方案)。我可以使用 https 使现有端点安全吗? 如果是这样,我该怎么做?如何将我的客户端连接到网络中的另一台电脑上?

这将是我的服务 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>

【问题讨论】:

  • App.config 还是 Web.Config? I.o.w 它是如何托管的?
  • 对不起,这是一个 XML 配置文件。它托管在同一网络上的电脑上。
  • 这并不能回答我的任何问题。
  • 您如何托管它? IIS 还是服务?
  • 你能分享你的端点配置吗

标签: c# wcf


【解决方案1】:

您需要定义端口以在 Windows 上使用 ssl。

使用 netsh 命令完成,您可以阅读它的帮助:

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

【讨论】:

  • 现在有什么问题?你能启动服务吗?
  • 是的,我可以启动控制台显示未提供客户端证书的服务
  • 在这里查看如何使用命令行来要求客户端证书msdn.microsoft.com/en-us/library/ms733791.aspx。然后确保客户确实提供了一个
猜你喜欢
  • 2011-09-19
  • 2016-02-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-07-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多