Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 287
Googler Avatar asked Dec 06 '25 00:12

Googler


1 Answers

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.

like image 159
Ladislav Mrnka Avatar answered Dec 07 '25 19:12

Ladislav Mrnka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!