找不到与绑定WSHttpBinding的端点的scheme http匹配的基址。注册的基地址方案是[]

时间:2013-10-18 12:49:35

标签: wcf asp.net-membership

这是我第一次尝试使用Asp.Net会员提供商进行身份验证的WCF服务,我尝试做的很简单:
1-用户将注册和创建帐户的默认Asp Web应用程序(使用Asp.Net会员提供商)
2- WCF服务,只能由注册的成员使用

所以我尝试了这个例子:Configuring an ASP.NET Application to Use Membership

我创建了一个默认的Asp网络应用程序,会员资格正常 我的问题是配置WCF App.Config:
如果我错了,请大家指正 1-它是正确的示例(因为我想稍后使用该WCF服务从Winform App进行Asp.Net成员身份验证,每个人都说不要从winform中使用它,它不安全使用WCF服务)
2-如果是,请在此纠正我:我需要在WCF的App.Config中放置

  1. Connectionstring :指向保存用户的ASPNETDB.MDF数据库基本文件
  2. 会员/个人资料/角色提供者
  3. 行为
  4. 绑定:wsHttpBinding
  5. 3-如果奇迹出现我就在这里,这是我的App.Config文件:

        <?xml version="1.0" encoding="utf-8" ?>
            <configuration>
    
            <!--_______________________________________ Connection String-->
            <connectionStrings>
            <add name="ApplicationServices"
                 connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=E:\DOCUMENTS\CODE\WCFwsHttpBindingTest\WebAppWsHttpBinding\App_Data\aspnetdb.mdf;User Instance=true"
                 providerName="System.Data.SqlClient" />
          </connectionStrings>
    
          <system.web>
            <compilation debug="true" />
            <!--_________________________________________ Provider-->
            <membership>
              <providers>
                <clear/>
                <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" 
                            connectionStringName="ApplicationServices"
                            enablePasswordRetrieval="false" 
                            enablePasswordReset="true" 
                            requiresQuestionAndAnswer="false" 
                            requiresUniqueEmail="false"
                            maxInvalidPasswordAttempts="5" 
                            minRequiredPasswordLength="6" 
                            minRequiredNonalphanumericCharacters="0" 
                            passwordAttemptWindow="10"
                     applicationName="/" />
              </providers>
            </membership>
          </system.web>
    
          <system.serviceModel>
            <services>
              <service behaviorConfiguration="MyServiceBehavior" 
                       name="WCFwsHttpBinding.Service1">
    
    
                <endpoint address ="" 
                          binding="wsHttpBinding" 
                          bindingConfiguration="MembershipBinding"
                          name="ASPmemberUserName"
                          contract="WCFwsHttpBinding.IService1">
                </endpoint>
              </service>
            </services>
    
            <!--__________________________________________ Behavior-->
            <behaviors>
              <serviceBehaviors>
                <behavior name="MyServiceBehavior">
                  <serviceCredentials>
                    <userNameAuthentication userNamePasswordValidationMode="MembershipProvider" membershipProviderName="AspNetSqlMembershipProvider"/>
                  </serviceCredentials>
                </behavior>
              </serviceBehaviors>
            </behaviors>
    
            <!--__________________________________________ Binding-->
            <bindings>
              <wsHttpBinding>
                <binding name="MembershipBinding">
                  <security mode="Message">
                    <message clientCredentialType="UserName" />
                  </security>
                </binding>
              </wsHttpBinding>
            </bindings>
    
          </system.serviceModel>
    
        </configuration>
    

    当我尝试调试时,我收到此错误:

    Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding. Registered base address schemes are [].
    

    非常感谢您的帮助。

0 个答案:

没有答案