WCF Service Hosted in ASP.NET website – Windows Authentication not working

I am hosting a WCF service in an asp.net website. On IIS it has integrated windows authentication setting. I’m making call to wcf service method from one of the asp.net website pages using jquery. But, unfortunately, that call is asking for windows username/password which I already provided for the website. My understanding is the authentication token will be automatically passed to the wcf call as well.

Please let me know if there is something wrong with my configuration/ajax call.

The following is my configuration:

 <system.serviceModel>
<behaviors>
  <endpointBehaviors>
    <behavior name="EllipseBehavior">
      <enableWebScript />
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="EllipseBehavior" >
      <!-- Add the following element to your 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 for Service Orders");
                $.unblockUI();
            }
        },
        dataType: "json",
        success: this.onSuccess,
        error: this.onError
    });


Source: windows

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.