【发布时间】:2019-01-04 13:19:18
【问题描述】:
我正在使用托管在 IIS 中的 WCF 服务,但是当我尝试导航到端点时,我收到错误“不支持协议'https'”。它托管在本地运行 Windows 10 的 IIS 10 中。
服务正在使用带有 TransportWithMessageCredential 的 wsHttpBinding。
此错误与 SSL 证书或 IIS 有关吗?
我的本地计算机中已经有一个有效的本地主机证书 > 个人证书存储。
到目前为止我所做的尝试
- 将 httpsGetUrl 属性设置为 .svc 端点。
- 检查的 IIS 设置和默认协议设置为“http”,这意味着 http 和 https 协议均已启用。
- 检查应用程序池是否使用 .NET Framework 4.0
- 重新启动应用程序池
如果有人可以帮助我,我将不胜感激。
这是当前配置:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="XXX.Zoo.WebServices.ZooServices_3_0"
behaviorConfiguration="ZooServices_3_0_Behavior">
<endpoint
address="https://localhost/Zootest_3_0/ZooServices_3_0.svc"
binding="wsHttpBinding"
bindingConfiguration="ZooServices_3_0_Binding"
contract="XXX.Zoo.WebServices.IZooServices_3_0" />
<endpoint
address="https://localhost/Zootest_3_0/ZooServices_3_0.svc/mex"
binding="mexHttpsBinding"
contract="IMetadataExchange" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="ZooServices_3_0_Binding"
maxReceivedMessageSize="2147483647"
maxBufferPoolSize="2147483647" >
<readerQuotas
maxDepth="2147483647"
maxStringContentLength="2147483646"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647"/>
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None"
proxyCredentialType="None" realm="" />
<message clientCredentialType="Certificate"
negotiateServiceCredential="true" algorithmSuite="Default"
establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ZooServices_3_0_Behavior">
<serviceMetadata httpsGetEnabled="true"
httpsGetUrl="https://localhost/Zootest_3_0/ZooServices_3_0.svc" />
<serviceDebug includeExceptionDetailInFaults="False" />
<!--The serviceCredentials behavior defines a service
certificate which is used by the service to authenticate
itself to its clients and to provide message protection. -->
<serviceCredentials>
<serviceCertificate
findValue="localhost"
storeLocation="LocalMachine"
storeName="My"
x509FindType="FindBySubjectName" />
<clientCertificate>
<authentication
certificateValidationMode="ChainTrust"/>
</clientCertificate>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
【问题讨论】:
-
为了启用https协议,您应该在IIS站点绑定模块中启用https协议,并将使用传输层安全模式的https服务端点添加到服务中。
-
从技术上讲,HTTPS 不是一种协议,而是一种方案。协议是 HTTP 和 TLS。
标签: wcf