【发布时间】:2012-01-10 09:34:56
【问题描述】:
我使用的是 IIS 7。HTTPS 绑定在其上启用了端口号 443。我在网站下有一个 WCF 服务作为应用程序。我正在尝试基于http://msdn.microsoft.com/en-us/library/ms729700.aspx 向服务(使用basicHttpBinding)引入HTTPS 安全性
我收到以下错误 - “提供的 URI 方案 'https' 无效;预期'http'。”。当我检查事件日志时,它的堆栈跟踪如下:
Stack Trace : at System.ServiceModel.Channels.TransportChannelFactory`1.ValidateScheme(Uri via)
at System.ServiceModel.Channels.HttpChannelFactory.ValidateCreateChannelParameters(EndpointAddress remoteAddress, Uri via)
需要进行哪些更改才能使用 basicHttpBinding 在 HTTPS 上工作?
注意:证书是使用 IIS 7 中的“创建自签名证书”创建的。
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="serviceFaultBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="Business.TV.Clearance.Services.ServiceHandler"
behaviorConfiguration="serviceFaultBehavior">
<endpoint address=""
binding="basicHttpBinding"
contract="Business.TV.Clearance.Services.IServiceHandler"
bindingConfiguration="httpBinding">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
<bindings>
<basicHttpBinding>
<binding name="httpBinding"
maxReceivedMessageSize="2000000"
maxBufferSize="2000000">
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<extensions>
<behaviorExtensions>
<add name="serviceFaultBehavior"
type="Business.TV.Clearance.Services.ServiceFaultBehaviorExtensionElement,Business.TV.Clearance.Services, Version=1.0.0.0, Culture=neutral"/>
</behaviorExtensions>
</extensions>
</system.serviceModel>
【问题讨论】:
-
你试过在端点地址中显式吗?
-
我尝试使用显式地址“10.10.XXX.YYY/MyService/ServiceHandler.svc”。仍然存在同样的问题。没有其他终点。
-
取决于您的证书的颁发目的。它通常用于机器名称,而不是 IP。您在配置中有其他端点吗?您是否尝试过指定端点地址?
-
也应该是机器名 -
证书是使用 IIS 7 中的“创建自签名证书”创建的。