找不到与绑定BasicHttpBinding的端点的方案https匹配的基址

mic*_*ael 4 c# wcf web-services

我正在尝试仅使用传输安全性创建WCF服务,因此我不需要SSL.

我在运行它时不断发出此错误消息:

Could not find a base address that matches scheme https for the endpoint with binding 
BasicHttpBinding.
Run Code Online (Sandbox Code Playgroud)

我的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>
Run Code Online (Sandbox Code Playgroud)

Raj*_*esh 6

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

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

注意:确保仅在您确信客户端和服务器通道安全时才使用此功能,例如在提供安全性的防火墙后面.