c# - How to enable stream transfer with WCF service on Azure with Membership / Authorization? -
i have hit wall , have been pulling hair quite time now. basically, need create wcf service have asp.net membership , authorization providers, needs allow transfer of byte[] arrays or stream objects , save them azure. service hosted on azure.
the problem have wcf wants message layer security exchange of client credentials. had following config works pretty well:
<system.servicemodel> <behaviors> <servicebehaviors> <behavior name="defaultservicebehavior"> <servicemetadata httpsgetenabled="true" /> <servicedebug includeexceptiondetailinfaults="true" /> <serviceauthorization principalpermissionmode="useaspnetroles" roleprovidername="sqlroleprovider" /> <servicecredentials> <servicecertificate x509findtype="findbysubjectname" storename="my" storelocation="localmachine" findvalue="securechannelcertificate" /> <usernameauthentication usernamepasswordvalidationmode="membershipprovider" membershipprovidername="sqlmembershipprovider" /> </servicecredentials> </behavior> </servicebehaviors> </behaviors> <bindings> <wshttpbinding> <binding name="securebinding" messageencoding="mtom"> <security mode="message"> <message clientcredentialtype="username" negotiateservicecredential="true" establishsecuritycontext="true" /> </security> </binding> </wshttpbinding> </bindings> </system.servicemodel>
so requirements changed , required push files azure via wcf service. no matter do, wcf screams @ me sorts of errors.
does know how configure service can use authentication/authorization streaming?
thanks!
although information provided not sufficient determine problem, think reason getting errors due wcf default message size limits such message, content , array length.
default values these settings low (64k maxreceivedmessagesize, 16k maxarraylength , 8k maxstringcontentlength) transfer large data via wcf , should increased able process messages or byte arrays contain larger data. can change these default values using readerquotas , wshttpbinding/binding elements.
here sample settings based on configuration file allow 4mb message, string , byte array transfer.
<system.servicemodel> <behaviors> <servicebehaviors> <behavior name="defaultservicebehavior"> <servicemetadata httpsgetenabled="true" /> <servicedebug includeexceptiondetailinfaults="true" /> <serviceauthorization principalpermissionmode="useaspnetroles" roleprovidername="sqlroleprovider" /> <servicecredentials> <servicecertificate x509findtype="findbysubjectname" storename="my" storelocation="localmachine" findvalue="securechannelcertificate" /> <usernameauthentication usernamepasswordvalidationmode="membershipprovider" membershipprovidername="sqlmembershipprovider" /> </servicecredentials> </behavior> </servicebehaviors> </behaviors> <bindings> <wshttpbinding> <binding name="securebinding" messageencoding="mtom" maxreceivedmessagesize="4194304"> <readerquotas maxstringcontentlength="4194304" maxarraylength="4194304"/> <security mode="message"> <message clientcredentialtype="username" negotiateservicecredential="true" establishsecuritycontext="true" /> </security> </binding> </wshttpbinding> </bindings> </system.servicemodel>
Comments
Post a Comment