WCF Service Hosted in ASP.NET website - Windows Authentication not working -
i hosting wcf service in asp.net website. on iis has integrated windows authentication setting. i'm making call wcf service method 1 of asp.net website pages using jquery. but, unfortunately, call asking windows username/password provided website. understanding authentication token automatically passed wcf call well.
please let me know if there wrong configuration/ajax call.
the following configuration:
<system.servicemodel> <behaviors> <endpointbehaviors> <behavior name="ellipsebehavior"> <enablewebscript /> </behavior> </endpointbehaviors> <servicebehaviors> <behavior name="ellipsebehavior" > <!-- add following element service behavior configuration. --> <servicemetadata httpgetenabled="true" /> </behavior> </servicebehaviors> </behaviors> <servicehostingenvironment aspnetcompatibilityenabled="true" /> <services> <service name="ellipseservice" behaviorconfiguration="ellipsebehavior"> <endpoint address="" behaviorconfiguration="xx.services.behaviour.ellipsebehavior" binding="webhttpbinding" contract="xx.services.contract.iellipseservice" /> </service> </services> <bindings> <basichttpbinding> </basichttpbinding> </bindings> <client> </client> ajax call
$.ajax({ type: "get", url: "/services/ellipse.svc/getworkordersbyline", data: { linecode: workorder.getlinecode() }, contenttype: "application/json; charset=utf-8", statuscode: { 404: function() { alert("incorrect uri service orders"); $.unblockui(); } }, datatype: "json", success: this.onsuccess, error: this.onerror });
you need use 'transportcredentialonly' attribute in binding. article explains pretty well:
https://msdn.microsoft.com/en-us/library/ff648505.aspx
how to: use basichttpbinding windows authentication , transportcredentialonly in wcf windows forms
this how-to article walks through process of using windows authentication on basichttpbinding binding using transportcredentialsonly security mode. article shows how configure wcf, configure internet information services (iis) windows authentication, , test service sample wcf client.
Comments
Post a Comment