asp.net - Sending Windows credentials with WCF service call -
i calling wcf service asp.net application (.net 4.5 , iis 7). web application configured use windows authentication.
<authentication mode="windows" />
i trying send windows user credentials identity principle service. @ service end, going additional authorisation logic manually. not getting windowsprinciple @ service end. instead genericprinciple type , hence principle name coming blank. new wcf configurations. missing here?
both web application , wcf hosted in iis 7 on same machine.
here web.config setting @ client side.
<system.servicemodel> <bindings> <basichttpbinding> <binding name="basichttpbidning_iservice" maxreceivedmessagesize="2147483647"> </binding> </basichttpbinding> <client> <endpoint address="http://localhost/mywebserviceapp/api/myapiservice.svc" binding="basichttpbinding" bindingconfiguration="basichttpbidning_iservice" contract="application.api.iservice" name="basichttpbidning_iservice" > </endpoint> </client> </system.servicemodel>
service side:
<service name="myapiservice" behaviorconfiguration="publicservicetypebehaviors"> <endpoint address="" binding="basichttpbinding" bindingconfiguration="basichttpbidning_ipublicservice" contract="application.api.iservice" name="basichttpbidning_iservice" /> <endpoint address="mex" binding="mexhttpbinding" contract="imetadataexchange" /> </service> <system.servicemodel> <client /> <servicehostingenvironment multiplesitebindingsenabled="false" minfreememorypercentagetoactivateservice="1" /> <bindings> <basichttpbinding> <binding name="basichttpbidning_ipublicservice" maxreceivedmessagesize="2147483647" /> </basichttpbinding> </bindings> <behaviors> <endpointbehaviors> <behavior name="webhttpbidning_ipublicservice"> <webhttp/> </behavior> </endpointbehaviors> <servicebehaviors> <behavior name="publicservicetypebehaviors"> <servicemetadata httpgetenabled="true" httpsgetenabled="true"/> <servicedebug includeexceptiondetailinfaults="true" /> </behavior> <behavior> <servicemetadata httpgetenabled="true" /> <servicedebug includeexceptiondetailinfaults="false" /> </behavior> </system.servicemodel>
you have defined servicebehavior called "publicservicetypebehaviors", need make behavior include built-in authentication , authorization features of wcf.
windowsauthentication need under servicecrendentials.
for authorization if need, may add serviceauthorization , related role provider.
Comments
Post a Comment