0
私はJsonオブジェクトで作業する必要があるWCFサービスを実装しています。これまでのところこれが働いています。今、私はサービスがhttpsだけを受け入れるようにしたいので、httpはありません。Jsonとhttpsを実装するWcfサービス
両方の要件について、私はテストして動作するように見えるサンプルをいくつか見つけました。しかし、両方の要件を1つの設定ファイルに統合することはできません。
これは、サービスのための私の設定です:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2"/>
</system.web>
<system.serviceModel>
<services>
<service behaviorConfiguration="serviceBehavior" name="SMApi.SApi">
<endpoint address="" behaviorConfiguration="web" binding="webHttpBinding"
bindingConfiguration="" contract="SMApi.ISApi" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<!--/-->
<behavior name="serviceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
<!--/-->
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
</behavior>
</serviceBehaviors>
<!--/-->
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
<!--/-->
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="false"/>
</system.webServer>
</configuration>
'webHttpBinding'に輸送するセキュリティモードを設定してみてください。あなたはそれのためのあなたの設定にバインディング設定セクションを追加する必要があります。 – Tim