【发布时间】:2010-09-10 21:06:13
【问题描述】:
我已根据来自 MSDN 的these instructions 创建并配置了 SSL 证书。我收到this question 列出的错误消息,但不确定如何将该问题中接受的答案映射到我的 App.config 文件。配置文件的内容和服务本身在 http 上正常工作,只是在 https 上发生了问题。
我的App.config 文件目前是:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="TransportSecurity">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="LookupServiceHost" behaviorConfiguration="serviceBehaviour">
<host>
<baseAddresses>
<add baseAddress="https://localhost:54321/MyService"/>
</baseAddresses>
</host>
<endpoint address="" binding="wsHttpBinding" contract="ILookupService" bindingConfiguration="TransportSecurity" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="serviceBehaviour">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="False"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
Windows 事件日志中返回的错误异常:
服务无法启动。 System.ServiceModel.AddressAlreadyInUseException:HTTP 无法注册 URL https://+:54321/MyService/。另一个应用程序已经用 HTTP.SYS 注册了这个 URL。 ---> System.Net.HttpListenerException: 无法监听前缀“https://+:54321/MyService/”,因为它与机器上的现有注册冲突。
有人可以告诉我如何启用它吗?
【问题讨论】:
-
由于这是 .NET,您没有收到错误消息,而是收到了异常。请发布完整的例外情况。
-
@John,除了迂腐外,我确实声明我收到了与链接帖子相同的消息(IMO)。也就是说,我已在我的问题中添加了具体细节。
标签: c# windows-services wcf