gpt4 book ai didi

wcf - 在单个服务中使用带 SSL 的 wshttpBinding 和不带 SSL 的 wsHttpBinding

转载 作者:行者123 更新时间:2023-12-04 17:41:06 25 4
gpt4 key购买 nike

我想在单个服务中使用 wshttpbinding(带 SSL 和不带 SSL),但它不起作用,任何人都实现了它。所以请指导我如何实现这一目标?

<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="CommonBehaviour">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceCredentials>
<serviceCertificate findValue="AzilenTechnology" x509FindType="FindBySubjectName" />
</serviceCredentials>
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBindingConfig" closeTimeout="00:10:00"
openTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Mtom">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="wsHttpBindingConfig" closeTimeout="00:10:00" openTimeout="00:10:00"
sendTimeout="00:10:00" bypassProxyOnLocal="true" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647" messageEncoding="Mtom">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="CommonBehaviour" name="wcfAllInOne.wcfFileIO">
<endpoint binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" />
<endpoint address="http://localhost:82/WCFAllInOne/wcfFileIO.svc/basicHttpEndPoint" binding="basicHttpBinding"
bindingConfiguration="basicHttpBindingConfig" name="BasicHttp"
contract="wcfAllInOne.IwcfFileIO" />
<endpoint address="http://localhost:82/WCFAllInOne/wcfFileIO.svc/wsHttpBindingEndPoint" binding="wsHttpBinding"
bindingConfiguration="wsHttpBindingConfig" name="wsHttp" contract="wcfAllInOne.IwcfFileIO" />
<endpoint address="https://localhost:444/WCFAllInOne/wcfFileIO.svc/wsHttpSslEndPoint" binding="wsHttpBinding"
bindingConfiguration="wsHttpBindingConfig" name="wsHttpSsl"
contract="wcfAllInOne.IwcfFileIO" />
<endpoint binding="mexHttpsBinding" bindingConfiguration="" contract="IMetadataExchange" />
</service>
</services>

最佳答案

我找到了解决方案,为什么我的上次配置不起作用,

我的第一个错误是我对 wsHttpBinding 和 ssl 使用了相同的配置,而 wsHttpBinding 没有 SSL

在我的配置文件中,我刚刚为两个端点创建了一个“ wsHttpBindingConfig ”(一个有 http 地址,另一个有 https 地址),

现在我使用两种不同的配置来解决这个问题。

<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="CommonBehaviour">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceCredentials>
<serviceCertificate findValue="AzilenTechnologies" x509FindType="FindBySubjectName" />
</serviceCredentials>
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBindingConfig" closeTimeout="00:10:00"
openTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Mtom">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security>
<transport>
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
</security>
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="wsHttpsBindingConfig" closeTimeout="00:10:00"
openTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="true"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Mtom">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Transport">
<transport clientCredentialType="None">
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
</security>
</binding>
<binding name="wsHttpBindingConfig" closeTimeout="00:10:00" openTimeout="00:10:00"
sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Mtom">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security>
<transport>
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="CommonBehaviour" name="wcfAllInOne.wcfFileIO">
<endpoint binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" />
<endpoint address="/basicHTTPEndPoint" binding="basicHttpBinding"
bindingConfiguration="basicHttpBindingConfig" name="basicHttp"
contract="wcfAllInOne.IwcfFileIO" />
<endpoint address="/wsHTTPEndPoint" binding="wsHttpBinding" bindingConfiguration="wsHttpBindingConfig"
name="wsHttp" contract="wcfAllInOne.IwcfFileIO" />
<endpoint address="/wsHTTPSEndPoint" binding="wsHttpBinding"
bindingConfiguration="wsHttpsBindingConfig" name="wsHttpSsl"
contract="wcfAllInOne.IwcfFileIO" />
<endpoint binding="mexHttpsBinding" bindingConfiguration="" contract="IMetadataExchange" />
</service>
</services>

关于wcf - 在单个服务中使用带 SSL 的 wshttpBinding 和不带 SSL 的 wsHttpBinding,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3714959/

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