2016-12-29 104 views
0

我創建了一個自我託管的WCF服務,充當REST API服務,使用webHttpBinding和CORS支持。我從瀏覽器使用此服務。使用webHttpBinding自行託管wcf與ssl

當我嘗試添加https時,它不起作用。

我創建的證書,並結合他們根據該教程:

https://www.youtube.com/watch?v=ugpPSNxtAmY

我的配置是:

<system.serviceModel> 
<services> 
    <service name="MyService.MyService"> 
    <endpoint address="" binding="webHttpBinding" contract="MyService.IMyService" behaviorConfiguration="jsonBehavior"> 
     <identity> 
     <dns value="MyMachine" /> 
     </identity> 
    </endpoint> 
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /> 
    </service> 
</services> 
<extensions> 
    <behaviorExtensions> 
    <add name="crossOriginResourceSharingBehavior" type="Company.Common.EnableCrossOriginResourceSharingBehavior, Company.Common" /> 
    </behaviorExtensions> 
</extensions> 
<behaviors> 
    <serviceBehaviors> 
    <behavior> 
     <!-- To avoid disclosing metadata information, 
     set the values below to false before deployment --> 
     <serviceMetadata httpGetEnabled="True" 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="False" /> 
    </behavior> 
    </serviceBehaviors> 
    <endpointBehaviors> 
    <behavior name="jsonBehavior"> 
     <webHttp /> 
     <crossOriginResourceSharingBehavior /> 
    </behavior> 
    </endpointBehaviors> 
</behaviors> 
<bindings> 
    <webHttpBinding> 
    <binding crossDomainScriptAccessEnabled="true" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferPoolSize="524288" 
    transferMode="Buffered"> 
     <readerQuotas maxDepth="32" maxStringContentLength="2147483647" 
     maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
     <security mode="Transport"> 
     <transport clientCredentialType="None"/> 
     </security> 
    </binding> 
    </webHttpBinding> 
</bindings> 
<standardEndpoints> 
    <webScriptEndpoint> 
    <standardEndpoint name="" crossDomainScriptAccessEnabled="true" /> 
    </webScriptEndpoint> 
</standardEndpoints> 
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/> 

當我嘗試使用我得到了一個錯誤。 我該怎麼做。 這項服務的客戶端瀏覽器

回答