gpt4 book ai didi

c# - .net WCF GET HTTPS 400 Bad Request 但适用于 Http

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

我在 Windows Server 2008 R2 上有一个 WCF。我有 SSL 证书。

使用 IE,http URL 工作正常(我得到了我的数据)但是使用 Https 我有一个 400 Bad Request。

在我的 wcf 的 web.config 下:

<?xml version="1.0" encoding="utf-8"?>

<bindings>
<basicHttpBinding>
<binding name="TransportSecurity">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>

<behaviors>
<endpointBehaviors>

<behavior name="ServiceRequestResourcesAspNetAjaxBehavior">
<webHttp defaultOutgoingResponseFormat="Json" />
</behavior>

<behavior name="ServiceRequestResourcesAspNetAjaxBehaviorHttps">
</behavior>

</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceRequestResourcesBehaviors">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>

<services>
<service behaviorConfiguration="ServiceRequestResourcesBehaviors"
name="BaseSite.ServiceRequestResources">

<endpoint address=""
behaviorConfiguration="ServiceRequestResourcesAspNetAjaxBehaviorHttps"
binding="basicHttpBinding"
bindingConfiguration="TransportSecurity"
contract="BaseSite.ServiceRequestResources" />

<endpoint address=""
behaviorConfiguration="ServiceRequestResourcesAspNetAjaxBehavior"
binding="webHttpBinding" contract="BaseSite.ServiceRequestResources" />

</service>
</services>

最佳答案

经过大量测试,它可以正常工作。我需要在 webHttpBinding 而不是 basicHttpBinding 中配置绑定(bind)部分,但我不知道为什么。

在我的绑定(bind)部分下面:

<bindings>
<webHttpBinding>
<binding name="TransportSecurity">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</webHttpBinding>
</bindings>

关于c# - .net WCF GET HTTPS 400 Bad Request 但适用于 Http,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14502326/

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