WCF基地址

时间:2012-07-09 22:04:40

标签: .net wcf

我有一个wcf服务 可通过http或https访问。它在共享托管环境中运行。

我取消了SSL托管。即已删除SSL的私有IP等

我没有对配置进行任何更改。

现在,如果我只是尝试访问我的服务,如

http://myservice.com/myservice.svc?wsdl

我收到以下错误:

无法找到与绑定BasicHttpBinding的端点的方案https匹配的基址。注册的基地址方案是[http]。

请注意,错误消息提到了 https 的方案。不知道为什么。

对此有何帮助?

使用配置信息更新

    

  <baseAddressPrefixFilters>
    <add prefix="http://mysite.com/"/>
  </baseAddressPrefixFilters>
</serviceHostingEnvironment>
<services>
  <service behaviorConfiguration="MySiteServiceBehavior" name="MySite.MyService">
    <clear/>
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="MySiteBasicBinding" name="MySiteBasicEndpoint"
      contract="MySite.IMyService"/>
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="MySiteBasicSslBinding" name="MySiteBasicSslEndpoint"
      contract="MySite.IMyService"/>
    <endpoint address="json" endpointConfiguration="myJson" kind="webHttpEndpoint" binding="webHttpBinding" bindingConfiguration="MySiteBasicBinding"
      name="jsonEndpoint" contract="MySite.IMyService" behaviorConfiguration="MySite.MyServiceBehavior.json"/>
    <endpoint address="json" endpointConfiguration="myJson" kind="webHttpEndpoint" binding="webHttpBinding" bindingConfiguration="MySiteBasicSslBinding"
      name="jsonSslEndpoint" contract="MySite.IMyService" behaviorConfiguration="MySite.MyServiceBehavior.json"/>
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
    <host>
      <baseAddresses>
        <add baseAddress="http://MySite.com/MyService.svc"/>
        <add baseAddress="https://MySite.com/MyService.svc"/> **--- still have problem with this line commented out**
      </baseAddresses>
    </host>
  </service>
</services>
<bindings>
  <basicHttpBinding>
    <binding name="MySiteBasicBinding"/>
    <binding name="MySiteBasicSslBinding">
      <security mode="Transport"/>
    </binding>
  </basicHttpBinding>
  <webHttpBinding>
    <binding name="MySiteBasicBinding"/>
    <binding name="MySiteBasicSslBinding">
      <security mode="Transport"/>
    </binding>
  </webHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="MySiteServiceBehavior">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> **--- still have problem with httpsGetEnabled set to false**
    </behavior>
  </serviceBehaviors>
  <endpointBehaviors>
    <behavior name="MySite.MyServiceBehavior.json">
      <!--<enableWebScript/>-->
    </behavior>
  </endpointBehaviors>
</behaviors>
<standardEndpoints>
  <webHttpEndpoint>
    <standardEndpoint name="myJson" helpEnabled="true" automaticFormatSelectionEnabled="true"/>
  </webHttpEndpoint>
</standardEndpoints>

更新

我删除了任何/所有与https远程相关的引用,并且它有效。 我很惊讶这是必要的。

1 个答案:

答案 0 :(得分:1)

听起来你在serviceBehaviors的行为元素上仍然有httpsGetEnabled。