目前,我们的一台客户端计算机中有一个作为 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>
任何人都知道如何解决这个问题以及我们需要做什么才能从 Windows 服务以 https 形式访问 url?
您可能还需要使用 netsh 或 HttpConfig 工具将 ssl 证书绑定到特定端口号,具体取决于操作系统版本。详细说明可以找到here http://msdn.microsoft.com/en-us/library/ms733791.aspx
在你的情况下,它可能是:
netsh http add sslcert ipport=0.0.0.0:18732 certhash=<certhash> appid={<guid>} clientcertnegotiation=enable
where
certhash = 您的证书指纹(X509Certificate2.Thumbprint)
appid = 可能只是 Guid.NewId()
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)