WCF使用Windows身份验证端点进行服务流式传输

时间:2011-11-17 20:29:00

标签: wcf

我有一个WCF服务,其中有两个端点由下面的配置文件定义:

 <system.serviceModel>
        <services>
          <service name="SyncService" behaviorConfiguration="SyncServiceBehavior">
            <endpoint name="Data" address="Data" binding="basicHttpBinding" bindingConfiguration="windowsAuthentication" contract="ISyncService"/>
            <endpoint name="File" address="File" binding="basicHttpBinding" bindingConfiguration="httpLargeMessageStream" contract="ISyncService"/>
            <endpoint address="mex" binding="webHttpBinding" bindingConfiguration="windowsAuthentication" contract="IMetadataExchange"/>
          </service>
        </services>
        <bindings>
          <basicHttpBinding>
            <binding name="httpLargeMessageStream" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed" messageEncoding="Mtom" />
            <binding name="windowsAuthentication" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
              <security mode="TransportCredentialOnly">
                <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""></transport>
                <message algorithmSuite="Default" clientCredentialType="UserName"/>
              </security>
            </binding>
          </basicHttpBinding>
          <webHttpBinding>
            <binding name="windowsAuthentication">
              <security mode="TransportCredentialOnly">
                <transport clientCredentialType="Windows"></transport>
              </security>
            </binding>
          </webHttpBinding>
      </bindings>
        <behaviors>
          <serviceBehaviors>
            <behavior name="SyncServiceBehavior">
              <serviceMetadata httpGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="true"/>
              <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"></serviceHostingEnvironment>
      </system.serviceModel>

我想对数据端点使用Windows身份验证,但最近发现您无法使用Windows身份验证通过HTTP进行流式传输。我删除了File端点的安全元素,但仍然收到以下错误:

  

HTTP请求流不能与HTTP一起使用   认证。禁用请求流或禁用匿名   HTTP身份验证。参数名称:bindingElement

是否可以在同一服务上使用两个端点使用不同的身份验证方法?为什么我不能使用Windows身份验证进行流式传输?

我也尝试了这个帖子中的建议,但无济于事:

Which authentication mode of basichhtpbinding can be used to secure a WCF Service using Streaming?

1 个答案:

答案 0 :(得分:0)

不幸的是,这不受支持。