gpt4 book ai didi

wcf - 如何在 WCF 服务中启用 HTTPS

转载 作者:行者123 更新时间:2023-12-04 21:42:55 27 4
gpt4 key购买 nike

我在 IIS 上托管了我的服务。

托管服务已应用 SSL 证书,在浏览 URL 时,它显示为 HTTPS。

但是,当我确实将此 URL 使用到客户端应用程序(ASP.NET WEB 应用程序)中时,它允许添加 https//domain/service.svc但是,在客户端配置中,URL 显示为 http而不是 https .什么时候手动修改,报错如下:The provided URI scheme 'https' is invalid; expected 'http'.
下面是 WCF 服务配置(托管在 IIS 上):

<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="customBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>

<bindings>
<basicHttpBinding>
<binding name="basicBindingConfiguration" closeTimeout="00:05:00"
openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />

<security mode="None">

</security>
</binding>
</basicHttpBinding>
</bindings>

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="0" />
<services>
<service name="Administrator.OAP.CRMServices.CRMServices"
behaviorConfiguration="customBehavior">
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="basicBindingConfiguration"
contract="Administrator.OAP.CRMServices.Contracts.ICRMServices" />
</service>
</services>

谁能指导我这里有什么问题或需要更改才能仅使用 HTTPS 使用此服务?

最佳答案

你的绑定(bind)有这个:

<security mode="None">

这意味着您的服务不希望使用任何类型的安全性。 HTTPS是传输认证,所以需要设置:
<security mode="Transport">

以下链接包含有关在 WCF 中设置传输安全性的有用信息: http://msdn.microsoft.com/en-us/library/ms733043(v=vs.110).aspx

关于wcf - 如何在 WCF 服务中启用 HTTPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26784776/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com