WCF 服务的 basicHttpBinding 上的 HTTPS
我正在使用 IIS 7。在其上启用了 HTTPS 绑定,端口号为 443。我在网站下有一个 WCF 服务作为应用程序。我试图将 HTTPS 安全引入基于 http:// 的服务(使用 basicHttpBinding) msdn.microsoft.com/en-us/library/ms729700.aspx
我收到以下错误 – “提供的 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>
I am using IIS 7. HTTPS binding is enabled on it with port number 443. I have a WCF service as an application under the website. I am trying to introduce HTTPS security to service (with basicHttpBinding) based on http://msdn.microsoft.com/en-us/library/ms729700.aspx
I am getting the following error – “The provided URI scheme 'https' is invalid; expected 'http'.”. When I checked the event log it has the stack trace as follows:
Stack Trace : at System.ServiceModel.Channels.TransportChannelFactory`1.ValidateScheme(Uri via)
at System.ServiceModel.Channels.HttpChannelFactory.ValidateCreateChannelParameters(EndpointAddress remoteAddress, Uri via)
What is the change required to make it working on HTTPS with basicHttpBinding?
Note: Certificate is created using "Create Self Signed Certificate" in 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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要将: 更改
为:
You need to change:
to:
请尝试如下所示:
现在,在虚拟目录上的 IIS 上,您需要映射 443 以接受 Https 流量并分配一个用于保护传输层的证书。
Please try as shown below:
Now on your IIS on the virtual directory you need to have mapped 443 to accept Https traffic and assign a certificate that it needs to use for securing the transport layer.
请尝试替换以下内容,这应该可行。
原文:
替换为:
Please try to replace the below, this should work.
Original:
Replace with: