VS 2010 VB.NET HTTPS服务参考

时间:2015-05-18 16:39:21

标签: asp.net vb.net

我有一个使用http连接到Web服务的Windows应用程序。我一直在网上阅读一些关于如何使用https进行连接的文章。我已经设置IIS使用https但我无法让应用程序使用它。它不是WCF服务。

调用Web服务时收到的错误是

提供的URI方案“https”无效;预计'http'。 参数名称:via

我已经读过我需要将安全模式添加到app.config,但是当我这样做时,它不会改变我的错误。

这是我的app.config摘录。

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="Service1SoapClient" openTimeout="00:11:00" sendTimeout="00:11:00"
          maxReceivedMessageSize="9999999"/>
        <binding>
          <security mode="Transport"></security>
        </binding>
      </basicHttpBinding>
         </bindings>
    <client>
      <endpoint address="https://lenovo-pc/service1.asmx" binding="basicHttpBinding"
        bindingConfiguration="Service1SoapClient" contract="BankService.Service1Soap"
        name="Service1Soap" />
      </client>
  </system.serviceModel> 

1 个答案:

答案 0 :(得分:0)

我想我明白了。这是我接过的一些事情,但结果却是以下工作。

 <system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="Service1SoapClient" openTimeout="00:11:00" sendTimeout="00:11:00"
      maxReceivedMessageSize="9999999">
      <security mode="Transport">
        <transport clientCredentialType="None" proxyCredentialType="None"
          realm="" />
        <message clientCredentialType="Certificate" algorithmSuite="Default" />
      </security>
    </binding>
   </basicHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="secureBehaviours">
      <serviceMetadata httpsGetEnabled="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<client>
  <endpoint address="https://lenovo-pc/service1.asmx" binding="basicHttpBinding"
    bindingConfiguration="Service1SoapClient" contract="BankService.Service1Soap"
    name="Service1Soap" />
 </client>