我一直在使用Stack Overflow并在an online tutorial之后使用SSL和WebHttpBinding。
我收到了与那里提到的相同的错误。我已经恢复到旧的Web配置,如下所示。我的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>'
我添加网址后发生新错误:
无法找到与方案https匹配的基地址 绑定MetadataExchangeHttpsBinding的端点。注册基地 地址方案是[]。
我尝试了两种方式,但都有错误。
向metadatabinding
添加绝对地址会让我犯这个错误:
ServiceMetadataBehavior的HttpsGetEnabled属性设置为true 而HttpsGetUrl属性是一个相对地址,但没有 https基地址。提供https基地址或设置 HttpsGetUrl到绝对地址。
使用基地址我收到此错误:
无法找到与方案https匹配的基地址 绑定MetadataExchangeHttpsBinding的端点。注册基地 地址方案是[]。
注意:我已使用基地址更改了上面的代码。
答案 0 :(得分:9)
您有一个MEX端点,其地址使WCF认为它是相对的,但您没有提供基址。例如,将MEX端点更改为:
<endpoint address="https://testsite/_vti_bin/TestingSQL/mex"
binding="mexHttpsBinding"
contract="IMetadataExchange"/>
要么是这样,要么指定BaseAddress并在端点上使用它。
此外,您可能需要调整serviceMetaData元素,特别是httpsGetUrl。