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

时间:2013-08-12 14:56:00

标签: c# asp.net .net wcf web-services

我搜索了所有的SO,并在其他一些网站上花了几个小时来解决这个错误,包括asp.net论坛。但由于以下错误,我无法执行或添加我的Web服务的服务引用:

  

无法找到与方案http匹配的基地址   绑定WebHttpBinding的端点。注册的基地址方案   是[]。

实际上我正试图从我网站的子域执行我的网络服务,而且我是WCF服务的新手。我试过ASMX服务,但是有人告诉我他们现在已被弃用了。所以我切换到WCF。以下是我的网络服务的web.config

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

  <appSettings/>
  <connectionStrings>
      <add connectionString="...HIDDEN..."/>
    </connectionStrings>
  <system.web><customErrors mode="Off"/>
    <compilation debug="true">

      <assemblies>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
    </compilation>
    <!--
        The <authentication> section enables configuration 
        of the security authentication mode used by 
        ASP.NET to identify an incoming user. 
    -->
    <authentication mode="Windows" />
    <!--
        The <customErrors> section enables configuration 
        of what to do if/when an unhandled error occurs 
        during the execution of a request. Specifically, 
        it enables developers to configure html error pages 
        to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
         <error statusCode="403" redirect="NoAccess.htm" />
         <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
    -->
    <pages>
      <controls>

        </controls>
    </pages>

    <httpHandlers>
      <remove verb="*" path="*.asmx"/>


    </httpHandlers>
    <httpModules>

    </httpModules>
  </system.web>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
                type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <providerOption name="CompilerVersion" value="v3.5"/>
        <providerOption name="WarnAsError" value="false"/>
      </compiler>
    </compilers>
  </system.codedom>
  <!-- 
      The system.webServer section is required for running ASP.NET AJAX under Internet
      Information Services 7.0.  It is not necessary for previous version of IIS.
  -->
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
      <remove name="ScriptModule" />

    </modules>
    <handlers>
      <remove name="WebServiceHandlerFactory-Integrated"/>
      <remove name="ScriptHandlerFactory" />
      <remove name="ScriptHandlerFactoryAppServices" />
      <remove name="ScriptResource" />



    </handlers>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>
  <runtime>
    <assemblyBinding appliesTo="v2.0.05727" xmlns="urn:schemas-microsoft-com:asm.v1">


    </assemblyBinding>
  </runtime>
  <system.serviceModel>
<bindings>
     <webHttpBinding>
         <!-- configure the maxReceivedMessageSize value to suit the max size of 
                  the request (in bytes) you want the service to receive-->
         <binding name="higherMessageSize" transferMode="Streamed"  
          maxReceivedMessageSize="2147483647"><security mode="None" /></binding>
     </webHttpBinding>
 </bindings>
    <services>
      <service behaviorConfiguration="MyNamespace.Service1Behavior"
        name="MyNamespace.MyService">
        <endpoint address="http://subdomain.domain.in/MyService.svc" binding="basicHttpBinding" contract="MyNamespace.IService1">
          <identity>
            <dns value="subdomain.domain.in" />
          </identity>
        </endpoint>
<endpoint address="" binding="webHttpBinding" bindingConfiguration="higherMessageSize" contract="MyNamespace.IService1"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior name="MyNamespace.Service1Behavior">
          <!-- To avoid disclosing metadata information, set the value below to false before deployment -->
          <serviceMetadata httpGetEnabled="false"/>
          <!-- 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>
    </behaviors>
<serviceHostingEnvironment>
        <baseAddressPrefixFilters>
            <add prefix="net.tcp://subdomain.domain.in:8000"/>
            <add prefix="http://subdomain.domain.in:9000"/>
        </baseAddressPrefixFilters>
    </serviceHostingEnvironment>
  </system.serviceModel>

</configuration>

请告诉我如何解决这个问题?

0 个答案:

没有答案