4

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

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

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

我的 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>
4

3 回答 3

6

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

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

注意:确保仅当您确信您的客户端和服务器通道是安全的(例如在提供安全性的防火墙之后)时才使用此选项。

于 2012-05-17T08:40:58.777 回答
1

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

于 2013-03-12T19:52:14.457 回答
1

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

所以:

<endpoint binding="basicHttpBinding" address="https://address" bindingConfiguration="Binding1" 
          contract="AutoSenderWCFService.IService1" />  
于 2012-05-17T07:04:23.620 回答