在WCF中获取绑定错误。我不明白这是什么。

在WCF中获取绑定错误。我不明白这是什么。,wcf,wcf-binding,Wcf,Wcf Binding,找不到与绑定为BasicHttpBinding的终结点的方案https匹配的基址。注册的基址方案为[http] Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the c

找不到与绑定为BasicHttpBinding的终结点的方案https匹配的基址。注册的基址方案为[http]

 Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

 Exception Details: System.InvalidOperationException: Could not find a base address that matches scheme https for the endpoint with binding BasicHttpBinding. Registered base address schemes are [http].

 Source Error: 

  An unhandled exception was generated during the execution of the current web request.     Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

 Stack Trace: 


   [InvalidOperationException: Could not find a base address that matches scheme https for the endpoint with binding BasicHttpBinding. Registered base address schemes are [http].]
System.ServiceModel.ServiceHostBase.MakeAbsoluteUri(Uri relativeOrAbsoluteUri,Binding Binding,UrischemeKeydCollection baseAddresses)+12366396 System.ServiceModel.Description.ConfigLoader.LoadServiceDescription(ServiceHostBase主机,ServiceDescription,ServiceElement ServiceElement,操作'1 addBaseAddress)+12363749 System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader ConfigLoader,ServiceDescription description,ServiceElement serviceSection)+67 System.ServiceModel.ServiceHostBase.ApplyConfiguration()+108 System.ServiceModel.ServiceHostBase.InitializeDescription(urischemeKeydCollection基地址)+192 System.ServiceModel.ServiceHost.InitializeDescription(类型serviceType,UrischemeKeydCollection baseAddresses)+49 System.ServiceModel.ServiceHost..ctor(类型serviceType,Uri[]基本地址)+151 System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(类型serviceType,Uri[]基本地址)+30 System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(字符串构造函数字符串,Uri[]基本地址)+422 System.ServiceModel.HostingManager.CreateService(字符串规范化VirtualPath)+1461 System.ServiceModel.HostingManager.ActivateService(字符串规范化VirtualPath)+44 System.ServiceModel.HostingManager.EnsureServiceAvailable(字符串规范化VirtualPath)+651

这是我的Web.config文件。请帮忙

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

     <system.web>
       <compilation debug="true" targetFramework="4.0" />
     </system.web>
     <connectionStrings>
       <add name="WWDbConnect"
            connectionString="Data Source=(dev0320);USER ID = scott; Password = t;Max Pool Size=200;"
            providerName="System.Data.SqlClient" />
     </connectionStrings>
     <system.serviceModel>
       <bindings>
         <basicHttpBinding>
           <binding name="BasicHttpBindingWithNoSecurity" maxBufferPoolSize="524288" maxReceivedMessageSize="500000">
             <security mode="Transport">
               <transport clientCredentialType="Certificate" proxyCredentialType="None"
                   realm="" />
               <message clientCredentialType="UserName" algorithmSuite="Default" />
             </security>
           </binding>
         </basicHttpBinding>
       </bindings>
       <client/>
       <services>
           <service name="WW.Common.Service.Impl.EmailService" behaviorConfiguration="BasicHttpBindingWithNoSecurity">
             <host>
               <baseAddresses>
                 <add baseAddress = "https://localhost:8270/Design_Time_Addresses/TestWcfEmailServiceLibrary/EmailService/" />
               </baseAddresses>
             </host>
             <endpoint address="EmailService" binding="basicHttpBinding" contract="WW.Common.Service.Contract.IEmailService" />
             <endpoint address="mex" binding="basicHttpBinding" bindingConfiguration="BasicHttpBindingWithNoSecurity" 
                       name="mexEndpoint" contract="IMetadataExchange" />
           </service>
         </services>
         <behaviors>
         <serviceBehaviors>
             <behavior name="EmailService">
               <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true"/>
               <serviceMetadata httpsGetEnabled="true" />
               <serviceSecurityAudit auditLogLocation="Application"
                  suppressAuditFailure="true"
                  serviceAuthorizationAuditLevel="Success"
                  messageAuthenticationAuditLevel="Success" />
           </behavior>
         </serviceBehaviors>
       </behaviors>
       <diagnostics>
         <messageLogging logEntireMessage="true"
                         maxMessagesToLog="3000"
                         logMessagesAtServiceLevel="true"
                         logMalformedMessages="false"
                         logMessagesAtTransportLevel="false" />
       </diagnostics>
       <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
     </system.serviceModel>
    <system.webServer>
       <modules runAllManagedModulesForAllRequests="true"/>
     </system.webServer>

   </configuration>

您在基址中使用的是https,但您的绑定是basicHttpBinding。查看您的配置,我假设您计划使用证书。我建议您将绑定更改为WSHttpBinding

<endpoint address="test" binding="wsHttpBinding" contract="WW.Common.Service.Contract.IEmailService"/>

或者,如果您只想使用http。将基址更改为http,如下所示。注意,我还从代码中删除了绑定配置

 <service name="WW.Common.Service.Impl.EmailService">
          <host>
            <baseAddresses>
              <add baseAddress = "http://localhost:8270/Design_Time_Addresses/TestWcfEmailServiceLibrary/EmailService/" />
            </baseAddresses>
          </host>
          <endpoint address="EmailService" binding="basicHttpBinding" contract="WW.Common.Service.Contract.IEmailService" />
          <endpoint address="mex" binding="basicHttpBinding" 
                    name="mexEndpoint" contract="IMetadataExchange" />
        </service>


我还建议您仔细阅读WCF绑定

我是WCF新手,所以我只是从另一个项目复制过来的。所以我不知道如何使用证书:-(现在,如果我必须使用一个简单的例子,我如何更改配置文件以使其工作?好的…如果不工作,您是否尝试使用证书。更改基址以删除https。我将更新我的answerBase地址,这意味着将https更改为http?我这样做了,但即使这样也无法完美工作。它工作正常。非常感谢。您有什么好文章吗要阅读WCF绑定吗?有太多了,我都不知道该读哪一个。如果你有一个基本的,解释清楚的东西会有帮助。谢谢。
 <service name="WW.Common.Service.Impl.EmailService">
          <host>
            <baseAddresses>
              <add baseAddress = "http://localhost:8270/Design_Time_Addresses/TestWcfEmailServiceLibrary/EmailService/" />
            </baseAddresses>
          </host>
          <endpoint address="EmailService" binding="basicHttpBinding" contract="WW.Common.Service.Contract.IEmailService" />
          <endpoint address="mex" binding="basicHttpBinding" 
                    name="mexEndpoint" contract="IMetadataExchange" />
        </service>