1

IIS6 (および開発環境では 7) でホストされている WCF アプリがあり、1 つの wsHttp (SOAP) と 2 つの webHttp (REST) バインディングがあります。

本番サイトに公開するときにサービスを保護し、メタデータと webHttp ヘルプ ページを無効にし、バインディングの SSL を有効にしたいと考えています。同時に、HTTPを無効にしたいと思います。IIS で「セキュア チャネルが必要」というオプションがあることは知っていますが、web.config でも同じことができるかどうか疑問に思っていました。

という印象を受けました

<security mode="Transport">

httpアクセスを「無効」にします(つまり、httpsが必要です)が、私の場合はそうではありませんでした。

彼女は web.config の ServiceModel 部分です。

<system.serviceModel>
<bindings>
  <wsHttpBinding>
    <binding name="SoapTransportSecurityBinding">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
        <message establishSecurityContext="false"/>
      </security>
    </binding>
  </wsHttpBinding>
  <webHttpBinding>
    <binding name="RestTransportSecurityBinding">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </webHttpBinding>
</bindings>
<services>
  <service name="CustomerWcfService" behaviorConfiguration="Web.ServiceBehavior">
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="SoapTransportSecurityBinding" contract="ICustomerWcfService">
      <identity>
        <dns value="ws.somecompany.com"/>
      </identity>
    </endpoint>
  </service>
  <service name="SentShipmentsWcfRestService" behaviorConfiguration="webHttpServiceBehavior">
    <endpoint address="" binding="webHttpBinding" bindingConfiguration="RestTransportSecurityBinding" contract="ISentShipmentsWcfRestService"
      behaviorConfiguration="RestEndpointBehavior"/>
  </service>
  <service name="InsuranceInfoWcfRestService" behaviorConfiguration="webHttpServiceBehavior">
    <endpoint address="" binding="webHttpBinding" bindingConfiguration="RestTransportSecurityBinding" contract="IInsuranceInfoWcfRestService"
      behaviorConfiguration="RestEndpointBehavior"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="Web.ServiceBehavior">
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
    <behavior name="webHttpServiceBehavior">
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
  <endpointBehaviors>
    <behavior name="RestEndpointBehavior">
      <webHttp helpEnabled="false"/>
    </behavior>
  </endpointBehaviors>
</behaviors>

4

1 に答える 1

0

web.config では実現できなかったようです。しかし、バインディング設定では、設定できます

      <security mode="Transport">

この場合、SSL が必要ない場合、エンドポイントは有効ではありません。

于 2012-04-19T16:04:41.330 に答える