gpt4 book ai didi

c# - WCF 使用 Https 服务

转载 作者:太空宇宙 更新时间:2023-11-03 15:00:35 25 4
gpt4 key购买 nike

目前我在我的应用程序中使用第三方 Web 服务,Web 服务是 SSL 的一种方式,但是在我使用我的 Visual Studio 中的服务之后。在 Web.Config 文件中,绑定(bind)服务变为无 SSL,它应该下载 Https,但现在是 Http。下面是我的网络服务。任何人在这里。请帮忙。谢谢

http://ws2.oriongateway.com:22836/willani2/services/ogltngws (No way SSL)
https://ws2.oriongateway.com:22837/willani2/services/ogltngws (1 way SSL)

我的应用程序配置

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="OglTngWsSoap11Binding1" />
</basicHttpBinding>
<customBinding>
<binding name="OglTngWsSoap12Binding1">
<textMessageEncoding messageVersion="Soap12" />
<httpTransport />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://ws2.oriongateway.com:22836/willani2/services/ogltngws.OglTngWsHttpSoap12Endpoint/"
binding="customBinding" bindingConfiguration="OglTngWsSoap12Binding1"
contract="aService.OglTngWsPortType" name="OglTngWsHttpSoap12Endpoint1" />
<endpoint address="http://ws2.oriongateway.com:22836/willani2/services/ogltngws.OglTngWsHttpSoap11Endpoint/"
binding="basicHttpBinding" bindingConfiguration="OglTngWsSoap11Binding1"
contract="aService.OglTngWsPortType" name="OglTngWsHttpSoap11Endpoint1" />
</client>
</system.serviceModel>
</configuration>

最佳答案

尝试下一个更改:

        <basicHttpBinding>
<binding name="OglTngWsSoap11Binding1" />
<security mode="Transport"> // add security mode
</basicHttpBinding>

将端点地址更改为 https,并且不要忘记更改端口:

            <endpoint address="https://ws2.oriongateway.com:22837/willani2/services/ogltngws.OglTngWsHttpSoap11Endpoint/"
binding="basicHttpBinding" bindingConfiguration="OglTngWsSoap11Binding1"
contract="aService.OglTngWsPortType" name="OglTngWsHttpSoap11Endpoint1" />

让我知道它是否有效。

关于c# - WCF 使用 Https 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22591440/

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