获取"Could not find a base address that matches scheme http for the endpoint with binding WSHttpBindin



我已经完成了Stack Overflow,并遵循了SSL和WebHttpBinding的在线教程。

我得到了与上面提到的相同的错误。我已经恢复到旧的网络配置,如下所示。我的https站点运行良好,我添加了WCF作为站点的一部分,以避免打开新端口。

我现在正试图达到这样的东西,当我得到错误:

https://localhost/_vti_bin/TestingSQL/sample.svc/mex

<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<services>
<service name="SharePointBits.Samples.WCFService.SampleService" behaviorConfiguration="SharePointBits.Samples.WCFService.SampleServiceBehavior">
<host> 
<baseAddresses> 
<add baseAddress="https://testsite/_vti_bin/TestingSQL/Sample.svc"/> 
</baseAddresses> 
</host>
<endpoint address="https://localhost/_vti_bin/TestingSQL/Sample.svc" binding="wsHttpBinding" contract="SharePointBits.Samples.WCFService.ISampleService" 
bindingConfiguration="wsHttpBindingEndpointBinding">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="wsHttpBinding">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="SharePointBits.Samples.WCFService.SampleServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpsGetEnabled="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>
<!--<behavior name="">-->
<!--<serviceMetadata httpGetEnabled="true" />-->
<!--</behavior>-->
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>'

在我添加我的网址后,出现了一个新的错误:

找不到与具有绑定MetadataExchangeHttpsBinding的终结点。注册基地地址方案是[]。

我尝试了两种方法,但都有错误。

metadatabinding添加绝对地址会导致以下错误:

ServiceMetadataBehavior的HttpsGetEnabled属性设置为trueHttpsGetUrl属性是一个相对地址,但没有https基地址。提供https基地址或设置HttpsGetUrl到一个绝对地址。

使用基本地址我得到这个错误:

找不到与具有绑定MetadataExchangeHttpsBinding的终结点。注册基地地址方案是[]。

注意:我已经使用基地址更改了上面的代码。

您有一个MEX端点,其地址使WCF认为它是相对的,但您没有提供基地址。将MEX端点更改为:

<endpoint address="https://testsite/_vti_bin/TestingSQL/mex" 
binding="mexHttpsBinding" 
contract="IMetadataExchange"/>

或者指定一个BaseAddress并在端点上使用它。

此外,您可能需要调整serviceMetaData元素,特别是httpsGetUrl。

最新更新