我试图使一个WCF服务在basicHttpBinding上使用https。这是我的web.config:

<!-- language: xml -->
<service behaviorConfiguration="MyServices.PingResultServiceBehavior"
         name="MyServices.PingResultService">
    <endpoint address="" 
              binding="basicHttpBinding" 
              bindingConfiguration="defaultBasicHttpBinding"
              contract="MyServices.IPingResultService">
        <identity>
            <dns value="localhost" />
        </identity>
    </endpoint>
    <endpoint address="mex" 
              binding="mexHttpBinding" 
              contract="IMetadataExchange" />
</service>
...
<bindings>
  <basicHttpBinding>
    <binding name="defaultBasicHttpBinding">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
...
<behaviors>
  <serviceBehaviors>
    <behavior name="MyServices.UpdateServiceBehavior">
      <serviceMetadata httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

我使用WCFStorm连接,它能够正确检索所有元数据,但当我调用实际的方法时,我得到:

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


当前回答

重新概括一下OP中的问题:

我连接[到一个WCF服务]使用WCFStorm,这是能够正确检索所有元数据,但当我调用实际的方法,我得到: 提供的URI方案'https'无效;预计“http”。参数名称:via

WCFStorm教程在使用IIS和SSL中解决了这个问题。

他们的解决方案对我很有效:

To fix the error, generate a client config that matches the wcf service configuration. The easiest way to do this is with Visual Studio. Open Visual Studio and add a service reference to the service. VS will generate an app.config file that matches the service Edit the app.config file so that it can be read by WCFStorm. Please see Loading Client App.config files. Ensure that the endpoint/@name and endpoint/@contract attributes match the values in wcfstorm. Load the modified app.config to WCFStorm [using the Client Config toobar button]. Invoke the method. This time the method invocation will no longer fail

第(1)项的最后一个项目实际上是指删除VS加在端点合约属性前的命名空间前缀,默认情况下为“ServiceReference1”

<endpoint ... contract="ServiceReference1.ListsService" ... />

所以在你加载到WCFStorm的app.config中,你想为ListsService:

<endpoint ... contract="ListsService" ... />

其他回答

我的解决方案,遇到同样的错误消息,甚至比上面的更简单,我只是更新到basichttpbinding >

  <bindings>
    <basicHttpsBinding>
    <binding name="ShipServiceSoap" maxBufferPoolSize="512000" maxReceivedMessageSize="512000" />
    </basicHttpsBinding>
    </bindings>

下面的部分也一样:

  <client>
    <endpoint address="https://s.asmx" binding="basicHttpsBinding" bindingConfiguration="ShipServiceSoap" contract="..ServiceSoap" name="ShipServiceSoap" />
    </client>

重新概括一下OP中的问题:

我连接[到一个WCF服务]使用WCFStorm,这是能够正确检索所有元数据,但当我调用实际的方法,我得到: 提供的URI方案'https'无效;预计“http”。参数名称:via

WCFStorm教程在使用IIS和SSL中解决了这个问题。

他们的解决方案对我很有效:

To fix the error, generate a client config that matches the wcf service configuration. The easiest way to do this is with Visual Studio. Open Visual Studio and add a service reference to the service. VS will generate an app.config file that matches the service Edit the app.config file so that it can be read by WCFStorm. Please see Loading Client App.config files. Ensure that the endpoint/@name and endpoint/@contract attributes match the values in wcfstorm. Load the modified app.config to WCFStorm [using the Client Config toobar button]. Invoke the method. This time the method invocation will no longer fail

第(1)项的最后一个项目实际上是指删除VS加在端点合约属性前的命名空间前缀,默认情况下为“ServiceReference1”

<endpoint ... contract="ServiceReference1.ListsService" ... />

所以在你加载到WCFStorm的app.config中,你想为ListsService:

<endpoint ... contract="ListsService" ... />

添加这个作为答案,因为你不能在注释中做太多花哨的格式。 我也遇到了同样的问题,只不过我完全用代码创建和绑定了我的web服务客户端。 原因是DLL被上传到一个系统,这禁止使用配置文件。

下面是代码,因为它需要更新以通过SSL通信…

Public Function GetWebserviceClient() As WebWorker.workerSoapClient
    Dim binding = New BasicHttpBinding()
    binding.Name = "WebWorkerSoap"
    binding.CloseTimeout = TimeSpan.FromMinutes(1)
    binding.OpenTimeout = TimeSpan.FromMinutes(1)
    binding.ReceiveTimeout = TimeSpan.FromMinutes(10)
    binding.SendTimeout = TimeSpan.FromMinutes(1)

    '// HERE'S THE IMPORTANT BIT FOR SSL
    binding.Security.Mode = BasicHttpSecurityMode.Transport

    Dim endpoint = New EndpointAddress("https://myurl/worker.asmx")

    Return New WebWorker.workerSoapClient(binding, endpoint)
End Function

改变 从

<security mode="None">

to

<security mode="Transport">

在你的网里。配置文件。此更改将允许您使用https而不是http

在我的情况下,在web。我不得不改变binding="basicHttpBinding"到binding="basicHttpBinding"在端点定义和复制相对bindingConfiguration到basicHttpBinding部分