2

RESTful と SOAP の WCF サービスを開発していますが、どちらも NTLM 認証を使用する必要があります。

また、他のユーザーがサービスを簡単に参照して操作できるように、MEX エンドポイントを公開したいと考えています。

Windows認証を要求するようにIISを設定すると、RESTサービスを使用してサービスを正常に呼び出すことができますが、SVCUTILでサービスを参照したい場合、匿名である必要があるというエラーがスローされます。

これが私のweb.configです:

<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<bindings>
  <basicHttpBinding>
    <binding name="basicHttpBinding" maxReceivedMessageSize="214748563" maxBufferSize="214748563" maxBufferPoolSize="214748563">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Ntlm">

        </transport>
      </security>
    </binding>
  </basicHttpBinding>
  <webHttpBinding>
    <binding name="webHttpBinding" maxReceivedMessageSize="214748563" maxBufferSize="214748563" maxBufferPoolSize="214748563">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Ntlm">

        </transport>
      </security>
    </binding>
  </webHttpBinding>
  <mexHttpBinding>
    <binding name="mexHttpBinding"></binding>
  </mexHttpBinding>
</bindings>
<standardEndpoints>
  <webHttpEndpoint>
    <standardEndpoint name="" automaticFormatSelectionEnabled="true" helpEnabled="True">
    </standardEndpoint>
  </webHttpEndpoint>
</standardEndpoints>
<services>
  <service name="Intel.ResourceScheduler.Service" behaviorConfiguration="Meta">
    <clear />
    <endpoint address="soap" name="SOAP" binding="basicHttpBinding" contract="Intel.ResourceScheduler.Service.IResourceSchedulerService" listenUriMode="Explicit" />
    <endpoint address="" name="rest" binding="webHttpBinding" behaviorConfiguration="REST" contract="Intel.ResourceScheduler.Service.IResourceSchedulerService" />
    <endpoint address="mex" name="mex" binding="mexHttpBinding" behaviorConfiguration="" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
  <endpointBehaviors>
    <behavior name="REST">
      <webHttp />
    </behavior>
    <behavior name="WCFBehavior">
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />
    </behavior>

  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="Meta">
      <serviceMetadata httpGetEnabled="true"/>
    </behavior>
    <behavior name="REST">
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />
    </behavior>
    <behavior name="WCFBehavior">
      <serviceMetadata httpGetEnabled="true"/>
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />
    </behavior>
    <behavior name="">
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="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>
</behaviors>

どんな助けでも大歓迎です。

4

1 に答える 1

1

mex サービスのバインドを変更してみてください。セキュリティが無効になっているため、mexHttpBinding では機能しません。まったく同じシナリオでこれをテストしたことはありませんが、私の場合、セキュリティのために変更する必要がありました。

あなたの例では、次のように変更してみます。

<endpoint address="mex" contract="IMetadataExchange" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding"/>

mex バインディング構成を SOAP サービス バインディング構成からより独立させるには、次のような個別の bindingConfiguration を定義して使用することもできます。

<binding name="secureMexHttpBinding" >
  <security mode="TransportCredentialOnly">
    <transport clientCredentialType="Ntlm">
    </transport>
  </security>
</binding>

次に、mex エンドポイントを変更します

endpoint address="mex" contract="IMetadataExchange" binding="basicHttpBinding" bindingConfiguration="secureMexHttpBinding"/>
于 2012-11-17T02:53:48.147 に答える