Я боролся с настройкой службы WCF, размещенной в приложении silverlight 4, как на https, так и на http. до сих пор мне удалось получить работу только через http или https, но не с обоими. Мне нужно, чтобы это вызывали оба.Как настроить службу WCF для работы как с https, так и с http
Ниже представлен мой полный раздел system.serviceModel в файле web.config.
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<bindings>
<customBinding>
<binding name="TestApp.Data.customBinding0">
<binaryMessageEncoding/>
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
</binding>
<binding name="TestApp.Data.customBinding0.https">
<binaryMessageEncoding/>
<httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
</binding>
</customBinding>
</bindings>
<services>
<service name="TestApp.Data" behaviorConfiguration="TestApp.Data">
<endpoint address="" binding="customBinding" bindingConfiguration="TestApp.Data.customBinding0" contract="TestApp.Data"/>
<endpoint address="mex" binding="mexHttpBinding" name="" contract="IMetadataExchange"/>
<endpoint address="" binding="customBinding" bindingConfiguration="TestApp.Data.customBinding0.https" contract="TestApp.Data"/>
<endpoint address="mexhttp" binding="mexHttpsBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="TestApp.Data" >
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
<behavior name="">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
А ниже мой полный ServiceReferences.ClientConfig
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<!--http-->
<binding name="CustomBinding_Data_http">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
<!--https-->
<binding name="CustomBinding_Data">
<binaryMessageEncoding />
<httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="//localhost/TestApp/Webservice/Data.svc" binding="customBinding" bindingConfiguration="CustomBinding_Data_http" contract="GetData.Data" name="CustomBinding_Data_http" />
<endpoint address="//localhost/TestApp/Webservice/Data.svc" binding="customBinding" bindingConfiguration="CustomBinding_Data" contract="GetData.GetData" name="CustomBinding_Data" />
</client>
С учетом указанных выше конфигураций, я только для вызова его по https, но я также должен иметь возможность называть его через http.
Когда я пытаюсь вызвать его через HTTP, я получаю ниже сообщение об ошибке
Предоставленный URI схема «HTTP» является недействительным; ожидаемый «https». Имя параметра: через
Какие изменения я я я должен сделать для этих конфигураций, чтобы получить эту вещь WCF работать над и HTTPS & HTTP.
Я не думаю, что возможно иметь как http и https на той же конечной точке. – Enes