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

一笑奈何 提交于 2019-12-09 18:47:46

问题


Details about my service:

  1. A file upload service
  2. Transfermode is set to stream
  3. Service is hosted in IIS 7.

I need to provide secuirty to my service. I have tried with ntlm and windows secuirty.I was getting the following error when i am trying to secure my service

"HTTP request streaming cannot be used in conjunction with HTTP authentication. Either disable request streaming or specify anonymous HTTP authentication."

I have found a description stating that: Description:

You can't do transport auth. with streaming. If you have to use HTTP request streaming, you'll have to run without security.

So i wish to know how can i secure my service? Which secuirty mode can i use with basichttpbinding?Can anyone pls help me on this?


回答1:


You can try using TransportWithMessageCredential:

<bindings>
  <basicHttpBinding>
    <binding name="securedStream" transferMode="streamed">
      <security mode="TransportWithMessageCredential">
        <message clientCredentialType="UserName" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>

This will pass credentials in SOAP header. Now you must either pass user's name and password - default validation is against Windows accounts but you can also use Membership provider or custom password validator.

If you really want NTLM or Windows then it means you are running both client and server in the same network / domain. In such case use Net.tcp instead.



来源:https://stackoverflow.com/questions/3200923/which-authentication-mode-of-basichhtpbinding-can-be-used-to-secure-a-wcf-servic

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!