gpt4 book ai didi

wcf - 通过 SSL 的 REST WCF 服务

转载 作者:太空宇宙 更新时间:2023-11-03 12:45:24 24 4
gpt4 key购买 nike

我正在尝试通过 SSL 配置 REST WCF 服务,但我不断收到:

Could not find a base address that matches scheme https for the endpoint with binding WebHttpBinding. Registered base address schemes are [http].

有人可以看看我的配置文件吗?谢谢。

  <system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsHttpBinding1">
<security>
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
<mexHttpsBinding>
<binding name="mexHttpsBinding1"/>
</mexHttpsBinding>
<webHttpBinding>
<binding name="webHttpBinding1">
<security mode="Transport" />
</binding>
</webHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="serviceBehavior" name="CompanyX.WebServices.WebApi">
<endpoint address="" behaviorConfiguration="WebApiBehavior" binding="webHttpBinding"
bindingConfiguration="webHttpBinding1" contract="CompanyX.WebServices.IWebApi">
<identity>
<certificateReference x509FindType="FindBySubjectName" findValue="CompanyXDev"
isChainIncluded="false" storeName="My" storeLocation="LocalMachine" />
</identity>
</endpoint>
<endpoint binding="mexHttpsBinding" bindingConfiguration="mexHttpsBinding1"
name="mex" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="WebApiBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceMetadata httpsGetEnabled="true" httpGetBinding="" httpsGetBinding="webHttpBinding"
httpsGetBindingConfiguration="webHttpBinding1" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceCredentials>
<clientCertificate>
<certificate findValue="CompanyXDev" x509FindType="FindBySubjectName" />
</clientCertificate>
<serviceCertificate findValue="CompanyXDev" x509FindType="FindBySubjectName" />
<userNameAuthentication userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="CompanyX.WebServices.CredentialsValidator, CompanyX.WebServices" />
<peer>
<certificate findValue="CompanyXDev" storeLocation="LocalMachine"
x509FindType="FindBySubjectName" storeName="My" />
</peer>
<issuedTokenAuthentication>
<knownCertificates>
<add findValue="CompanyXDev" storeLocation="LocalMachine" storeName="My"
x509FindType="FindBySubjectName" />
</knownCertificates>
</issuedTokenAuthentication>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>

</configuration>

最佳答案

让我猜猜:您是在 Developement 网络服务器 (Cassini) 中从 Visual Studio 运行您的服务,是吗?开发 Web 服务器不支持 HTTPS。您必须在 IIS 中托管您的服务,并按照 Greg 的建议为站点添加 HTTPS 绑定(bind)。

关于wcf - 通过 SSL 的 REST WCF 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4651431/

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