简体   繁体   English

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

[英]Could not find a base address that matches scheme http for the endpoint with binding BasicHttpBinding

I am getting this message when I attempt to access my service: 尝试访问我的服务时,我收到此消息:

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

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 http for the endpoint with binding BasicHttpBinding. Registered base address schemes are [https].

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 http for the endpoint with binding BasicHttpBinding. Registered base address schemes are [https].]
   System.ServiceModel.ServiceHostBase.MakeAbsoluteUri(Uri relativeOrAbsoluteUri, Binding binding, UriSchemeKeyedCollection baseAddresses) +17430541
   System.ServiceModel.Description.ConfigLoader.LoadServiceDescription(ServiceHostBase host, ServiceDescription description, ServiceElement serviceElement, Action`1 addBaseAddress, Boolean skipHost) +1097
   System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, ServiceElement serviceSection) +89
   System.ServiceModel.ServiceHost.ApplyConfiguration() +162
   System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses) +207
   System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses) +475
   System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses) +43
   System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +578
   System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +1451
   System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) +76
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +901

[ServiceActivationException: The service '/fileservice/fileservice.svc' cannot be activated due to an exception during compilation.  The exception message is: Could not find a base address that matches scheme http for the endpoint with binding BasicHttpBinding. Registered base address schemes are [https]..]
   System.Runtime.AsyncResult.End(IAsyncResult result) +654324
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +210877
   System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +282

I am using a config almost identical to another service I wrote on the same url different folder and I'm having no issues. 我使用的配置几乎与我在同一url不同文件夹中编写的另一项服务完全相同,并且没有任何问题。

This is my web.config: 这是我的web.config:

 <?xml version="1.0" encoding="utf-8"?>
<configuration>

  <system.web>
    <compilation targetFramework="4.0" debug="true">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>
    </compilation>
    <caching>
      <outputCacheSettings>
        <outputCacheProfiles>
          <add name="DefaultCache" duration="60" varyByParam="none" />
        </outputCacheProfiles>
      </outputCacheSettings>
    </caching>
  </system.web>

  <system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpEndpointBinding">
          <security mode="None">
            <!-- Basic <security mode="Transport"> -->
            <!-- To use Basic auth, just comment Windows and use this, but you need to configure basic in IIS as well -->
            <!-- <transport clientCredentialType="Basic" /> -->
            <transport clientCredentialType="None" />
          </security>
        </binding>
      </basicHttpBinding>
      <webHttpBinding>
        <binding name="default">
          <security mode="None">
            <!-- Basic <security mode="Transport"> -->
            <!-- To use Basic auth, just comment Windows and use this -->
            <!-- <transport clientCredentialType="Basic" /> -->
            <transport clientCredentialType="None" />
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- 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="true" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="restBehavior">
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <services>
      <service name="FileStorageService.FileService">
        <endpoint binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpointBinding" contract="FileStorageService.IFileService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="rest" binding="webHttpBinding" bindingConfiguration="default" behaviorConfiguration="restBehavior" contract="FileStorageService.IFileService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
      </service>
    </services>
  </system.serviceModel>

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>

</configuration>

The only thing I changed was the namespace and service name. 我唯一更改的是名称空间和服务名称。 The namespace for this service is FileStorageService with the service name being FileService . 该服务的名称空间是FileStorageService ,服务名称为FileService

I have really nothing in the server, as you can see in the code: 正如您在代码中看到的那样,服务器中实际上没有任何内容:

using System.ServiceModel;

namespace FileStorageService
{
  // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IFileService" in both code and config file together.
  [ServiceContract]
  public interface IFileService
  {
    [OperationContract]
    void DoWork();
  }
}

namespace FileStorageService
{
  // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "FileService" in code, svc and config file together.
  public class FileService : IFileService
  {
    public void DoWork()
    {
    }
  }
}

It's the basic information when a new service is created. 这是创建新服务时的基本信息。 It is publishing to a SSL domain, so it requires https. 它正在发布到SSL域,因此需要https。

All I'm attempting to do is get it published so I know it is working so I can move on. 我想要做的就是将其发布,因此我知道它正在工作,所以我可以继续。

Can anyone see what I am doing wrong? 谁能看到我在做什么错?

I don't have the rep to post as a comment, so here's a comment as an answer... 我没有代表作为评论发表,所以这里有评论作为答案...

I believe the problem is that you're attempting to host an SSL based service, but your binding configuration doesn't have a transport security type. 我认为问题在于您正尝试托管基于SSL的服务,但您的绑定配置没有传输安全性类型。 You need to modify the security mode on your basic binding to support transport security. 您需要在基本绑定上修改安全模式以支持传输安全性。 See here for the answer: 看到这里的答案:

WCF Exception: Could not find a base address that matches scheme http for the endpoint WCF异常:找不到与端点的方案http匹配的基地址

If that doesn't help, try hosting the service as a non HTTPS based service initially, so see if that works. 如果这样做没有帮助,请尝试首先将服务托管为基于非HTTPS的服务,以便查看是否可行。 This will validate the rest of your configuration is correct. 这将验证其余配置是否正确。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到与绑定BasicHttpBinding的端点匹配方案https的基地址。 注册的基址方案是http - Could not find a base address that matches scheme https for the endpoint with binding BasicHttpBinding. Registered base address schemes are http 找不到与绑定BasicHttpBinding的端点的方案https匹配的基址 - Could not find a base address that matches scheme https for the endpoint with binding BasicHttpBinding 找不到与绑定WSHttpBinding的端点的scheme http匹配的基址 - Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding 找不到与具有绑定 WebHttpBinding 的端点的方案 https 匹配的基址。 注册的基址方案是 [http] - Could not find a base address that matches scheme https for the endpoint with binding WebHttpBinding. Registered base address schemes are [http] 找不到与绑定WSHttpBinding的端点匹配方案http的基地址。 注册的基址方案为[https] - Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding. Registered base address schemes are [https] WCF错误。 找不到与绑定WSHttpBinding的端点的方案http匹配的基地址 - Error with WCF. Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding WCF找不到与绑定MetadataExchangeHttpBinding的端点的方案http匹配的基地址 - WCF Could not find a base address that matches scheme http for the endpoint with binding MetadataExchangeHttpBinding WCF 异常:找不到与端点的方案 http 匹配的基地址 - WCF Exception: Could not find a base address that matches scheme http for the endpoint 找不到与绑定 NetTcpBinding 的端点的方案 net.tcp 匹配的基地址。 基地址方案是 [http] - Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Base address schemes are [http] 找不到与绑定MetadataExchangeTcpBinding自托管端点的终结点计算机匹配方案net.tcp的基地址 - Could not find a base address that matches scheme net.tcp for the endpoint with binding MetadataExchangeTcpBinding self hosting
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM