简体   繁体   English

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

[英]WCF Streaming on service with Windows Authentication Endpoint

I have a WCF service with two endpoints defined by the configuration file below: 我有一个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>

I want to use windows authentication for the Data endpoint, but have recently discovered that you cannot use windows authentication for streaming over HTTP. 我想对数据端点使用Windows身份验证,但最近发现您不能使用Windows身份验证通过HTTP进行流式传输。 I removed the security element for the File endpoint, but still get the following error: 我删除了File端点的安全元素,但仍然收到以下错误:

HTTP request streaming cannot be used in conjunction with HTTP authentication. HTTP请求流不能与HTTP身份验证结合使用。 Either disable request streaming or specify anonymous HTTP authentication. 禁用请求流或指定匿名HTTP身份验证。 Parameter name: bindingElement 参数名称:bindingElement

Is it possible to have two endpoints on the same service use different authentication methods like this? 是否可以在同一服务上使用两个端点使用不同的身份验证方法? Why can't I use windows authentication for streaming? 为什么我不能使用Windows身份验证进行流式传输?

I have also tried what was suggested in this thread, but to no avail: 我也尝试了这个帖子中的建议,但无济于事:

Which authentication mode of basichhtpbinding can be used to secure a WCF Service using Streaming? basichhtpbinding的哪种身份验证模式可用于使用Streaming保护WCF服务?

不幸的是,这不受支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM