我已经为此搜索了所有 SO,并在其他一些网站上花了几个小时来解决这个错误,包括 asp.net 论坛。但是由于以下错误,我无法执行或添加我的 Web 服务的服务引用:
找不到与绑定 WebHttpBinding 的终结点的方案 http 匹配的基地址。注册的基地址方案是 []。
实际上,我正在尝试从我网站的子域执行我的 Web 服务,而我是 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>
请告诉我如何解决这个问题?