2014-02-18 51 views
0

我正在访问已在WAS服务器中设置的服务,其中如何启用http和https端点?

允许http和https端点访问。我如何修改我的app.config文件中的相同内容?

<?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> 

我使用.NET C#4.0

+1

与论坛网站不同,我们不使用“谢谢”或“任何帮助表示赞赏”,或在[so]上签名。请参阅“[应该'嗨','谢谢',标语和致敬从帖子中删除?](http://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be -removed-from-posts) –

+0

你正在使用的服务是公开HTTP? –

+0

@ MilanRaval-它既有http也有https,https://vissvc-int.e.corpintra.net/VisSvcNative/VisService。我想包括三个端点,一个端点和http,另外两个使用https。是在app.config中配置的一个是HTTP。 –

回答

0

您可能需要添加<httpsTransport><httpTransport>下也是如此。

有关<httpsTransport>标记的更多信息,请参阅MSDN

编辑:我的意思是应该为<httpsTransport>另一个绑定配置,例如:

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

还要注意的是,这些绑定名称必须匹配服务器配置。

+0

它表示绑定名称已存在

+0

您必须在httpsTransport的第二个绑定配置上使用不同的名称。你已经使用了“Soapbinding”这个名字。 – HOKBONG

+0

@ HOKBONG - 好的,但是应该由服务预定义吗? –