简体   繁体   中英

How can I enable both http and https endpoint?

I am accessing the service which has is setup in the WAS server that

allows both http and https endpoint access. How can I modify same in my app.config file?

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>    
<add key="WebServiceUrl1" value="http://vissvc-  test.e.corpintra.net/VisSvcNative/VisService"/>
<add key="LogoutUrl" value="http://login.e.corpintra.net/internal/logout"/>
</appSettings>
<system.net>
<defaultProxy >
  <proxy autoDetect ="True" />
</defaultProxy>
</system.net> 
<system.serviceModel>
<bindings>      
  <customBinding>
    <binding name="SoapBinding">  
      <customTextMessageEncoding encoding="UTF-8" messageVersion="Soap11" />  
      <httpTransport/>          
    </binding>       
  </customBinding>      
</bindings>        
<client>
  <endpoint address="http://vissvc-test.e.corpintra.net/VisSvcNative/VisService"
            binding="customBinding" bindingConfiguration="SoapBinding"                contract="ServiceReference1.VisServicePortType" name="VisService" behaviorConfiguration="behavior" />      
               </client>
 </system.serviceModel>
 </configuration>

I am using .net c# 4.0

You might need to add <httpsTransport> under <httpTransport> as well.

Take a look at MSDN for more information on the <httpsTransport> tag.

EDIT: What I mean is there should be another binding configuration for the <httpsTransport> , for example:

<bindings>      
  <customBinding>
     <binding name="SoapBinding">
        <httpTransport />
     </binding>
     <binding name="HttpsSoapBinding">
        <httpsTransport />
     </binding>     
  </customBinding>      
</bindings>  

Also note that these binding names have to match that on the server configuration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM