rea*_*pen 2 ssl wcf windows-services client-certificates wcfserviceclient
当前,在我们的一台客户端机器中,有一个作为 Windows 服务托管的 Wcf 服务,实际上目前这是正常的 http 调用。由于我们需要使用 https 而不是 http,为此我们修改了 app.config 但在启动服务后 https url 不起作用。然后我们尝试使用 URL 保留netsh http add urlacl url=https://+:18732/Peripheral/ user=Everyone。然后我们再次重新启动服务,它无法访问 https url .
我们在 URl 浏览器中收到错误 • 确保启用了 TLS 和 SSL 协议。
这与任何证书问题有关吗?如果是这样,我们如何才能解决这个问题?
web.config 提供如下:-
<system.serviceModel>
<standardEndpoints />
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<bindings>
<basicHttpBinding>
<binding name ="soapBinding">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding name="Bind1" crossDomainScriptAccessEnabled="true">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="Peripheral.Server.Impl.PeripheralServiceImpl" behaviorConfiguration="SvcBhvr">
<host>
<baseAddresses>
<add baseAddress="https://localhost:18732/Peripheral/" />
</baseAddresses>
</host>
<endpoint address="https://localhost:18732/Peripheral/" binding="webHttpBinding" behaviorConfiguration="EndPBhvr" bindingConfiguration="Bind1"
contract="Peripheral.Server.Contract.IPeripheralService">
<!--<identity>
<dns value="localhost" />
</identity>-->
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="EndPBhvr">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="SvcBhvr">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)
任何人都知道如何解决这个问题以及我们需要做什么以便我们能够从 Windows 服务以 https 形式访问 url?
小智 5
您可能还需要根据操作系统版本使用 netsh 或 HttpConfig 工具将 ssl 证书绑定到特定端口号。详细说明可以在这里找到
在你的情况下,它可能是:
netsh http add sslcert ipport=0.0.0.0:18732 certhash=<certhash> appid={<guid>} clientcertnegotiation=enable
Run Code Online (Sandbox Code Playgroud)
在哪里
certhash = 你的证书指纹(X509Certificate2.Thumbprint)
appid = 可能只是 Guid.NewId()
| 归档时间: |
|
| 查看次数: |
7767 次 |
| 最近记录: |