2012-09-23 17 views
9

Tôi đã trải qua Stack Overflow và theo dõi an online tutorial cho SSL và WebHttpBinding.Nhận "Không thể tìm thấy địa chỉ cơ sở khớp với lược đồ http cho điểm cuối với ràng buộc WSHttpBinding. Đề án địa chỉ cơ sở đã đăng ký là []"

Tôi nhận được lỗi tương tự như đã đề cập ở đó. Tôi đã hoàn nguyên về cấu hình web cũ như hình dưới đây. Trang web https của tôi đang hoạt động tốt và tôi đã thêm WCF của mình làm một phần của trang web để tránh phải mở một cổng mới.

Tôi đang cố gắng để đạt được một cái gì đó như thế này bây giờ khi tôi nhận được lỗi:

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>' 

Sau khi tôi đã thêm địa chỉ web của tôi một lỗi mới xảy ra:

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

tôi đã cố gắng cả hai cách và cả hai đều có lỗi.

Thêm một địa chỉ tuyệt đối để metadatabinding được tôi lỗi này:

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.

Sử dụng địa chỉ cơ sở tôi nhận được lỗi này:

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

Note: Tôi đã thay đổi mã trên bằng cách sử dụng địa chỉ cơ sở.

Trả lời

9

Bạn có điểm cuối MEX với địa chỉ khiến WCF nghĩ rằng nó là tương đối, nhưng bạn chưa cung cấp địa chỉ cơ sở. Thay đổi thiết bị đầu cuối MEX ví dụ để:

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

Hoặc là thế, hoặc chỉ định một BaseAddress và sử dụng trên thiết bị đầu cuối của bạn.

Ngoài ra, bạn có thể muốn tinh chỉnh phần tử serviceMetaData, cụ thể là httpsGetUrl.

+1

Tôi đã thử cả hai cách và nó không hoạt động và tôi đang bối rối về địa chỉ cơ sở. Tôi đã cố gắng thay đổi điểm cuối của mình thành "" sau khi thêm địa chỉ cơ sở nhưng nó đã cho tôi lỗi của điểm cuối bị trống, không nên nó trỏ đến địa chỉ cơ sở? Tôi đã đặt sai vị trí chưa? Tôi đã tham khảo http://msdn.microsoft.com/en-us/library/ms734786.aspx –

+1

Đủ công bằng. Bạn đã thử tinh chỉnh phần tử [serviceMetaData] (http://msdn.microsoft.com/en-us/library/ms731317.aspx) chưa? Cụ thể là httpsGetUrl? Hoặc cố gắng tạm thời xóa điểm cuối MEX? – Jeroen

+0

Có! bạn đúng rồi! Thêm httpsGetUrl hoạt động và điểm cuối của tôi là sai, tôi đã bao gồm tên tệp dịch vụ của mình đã đưa ra lỗi ghi rõ url đã được đăng ký. Cảm ơn rất nhiều thời gian của bạn! Cảm ơn! –

Các vấn đề liên quan