2012-09-23 21 views
9

我已經通過堆棧溢出並且遵循an online tutorial進行SSL和WebHttpBinding。獲取「無法找到與綁定WSHttpBinding的端點匹配方案http的基地址。註冊的基地址方案爲[]」

我回來了那裏提到的相同的錯誤。我已經恢復到舊的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>' 

後,我將我的網址出現新的錯誤:

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

我試着兩種方式都有錯誤。

添加一個絕對地址metadatabinding讓我這個錯誤:

The HttpsGetEnabled property of ServiceMetadataBehavior is set to true and the HttpsGetUrl property is a relative address, but there is no https base address. Either supply an https base address or set HttpsGetUrl to an absolute address.

使用的基址我得到這個錯誤:

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

注意:我已經改變了上面使用的代碼基地址。

回答

9

你有一個MEX端點,其地址使WCF認爲它是相對的,但是你沒有提供基地址。更改MEX端點例如:

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

要麼,或指定一個BaseAddress和使用您的端點。

此外,你可能想要調整serviceMetaData元素,特別是httpsGetUrl。

+1

我已經試過這兩種方式,它不起作用,我對基地址感到困惑。我試圖在添加基地址後將端點更改爲「」,但它給了我端點爲空的錯誤,是否不應該引用基地址?我是否放置在錯誤的位置?我提到http://msdn.microsoft.com/en-us/library/ms734786.aspx –

+1

不夠公平。您是否嘗試調整[serviceMetaData](http://msdn.microsoft.com/zh-cn/library/ms731317.aspx)元素?特別是httpsGetUrl?或嘗試暫時刪除MEX端點? – Jeroen

+0

是的!你是對的!添加httpsGetUrl工作和我的端點是錯誤的,我包括我的服務文件的名稱,它一直在提供錯誤,說明url已經註冊。非常感謝您的時間!謝謝! –

相關問題