C# 无法找到与具有绑定 BasicHttpBinding 的端点的方案 https 匹配的基地址

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10631215/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 14:35:22  来源:igfitidea点击:

Could not find a base address that matches scheme https for the endpoint with binding BasicHttpBinding

c#wcfweb-services

提问by michael

I am trying to create a WCF Service with only Transport Security so I do not need SSL.

我正在尝试创建一个仅具有传输安全性的 WCF 服务,因此我不需要 SSL。

I keep geting this error message when I run it:

当我运行它时,我不断收到此错误消息:

Could not find a base address that matches scheme https for the endpoint with binding 
BasicHttpBinding.

My Web.config file looks like this:

我的 Web.config 文件如下所示:

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>      
        <binding name="Binding1">
          <security mode="Transport">
            <transport clientCredentialType="Basic"></transport>
          </security>
        </binding>      
      </basicHttpBinding>

    </bindings>
    <services>
      <service behaviorConfiguration="ServiceBehavior" name="AutoSenderWCFService.AutoSenderService">        
        <endpoint binding="basicHttpBinding"  bindingConfiguration="Binding1"
          contract="AutoSenderWCFService.IService1" />        
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceCredentials>

            <userNameAuthentication userNamePasswordValidationMode="Custom"
              customUserNamePasswordValidatorType="AutoSenderWCFService.MyValidator, AutoSenderWCFService"/>

          </serviceCredentials>

          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>

采纳答案by Rajesh

Transport security means securing your channel with SSL and hence you would need a certificate.

传输安全意味着使用 SSL 保护您的频道,因此您需要一个证书。

If you dont want to use SSL but want to pass username password over the channel then you can use ClearUsernameBindingthat sends the username password over the channel in clear text.

如果您不想使用 SSL,但想通过通道传递用户名密码,那么您可以使用ClearUsernameBinding以明文形式通过通道发送用户名密码。

NOTE: Make sure you use this only when you are confident that you client and server channel is secure like behind a firewall that provides security.

注意:确保仅在您确信您的客户端和服务器通道是安全的时才使用它,就像在提供安全性的防火墙后面一样。

回答by Chris

I cant see any address in there - add an address to your endpoint and should be ok

我在那里看不到任何地址 - 向您的端点添加一个地址,应该没问题

so:

所以:

<endpoint binding="basicHttpBinding" address="https://address" bindingConfiguration="Binding1" 
          contract="AutoSenderWCFService.IService1" />  

回答by BrandonG

In my case I was trying to test a wcf web service setup on a testing server without ssl. I changed the security mode to none and it started working for me.

就我而言,我试图在没有 ssl 的测试服务器上测试 wcf Web 服务设置。我将安全模式更改为无,它开始为我工作。