<bindings> <webHttpBinding> <binding> <security mode="TransportCredentialOnly"> <transport clientCredentialType="Windows"></transport> </security> </binding> </webHttpBinding> </bindings>
Friday, January 10, 2014
AJAX Enabled WCF Service with Windows Authentication
Let's say you have a WCF Service that you are calling from jQuery code. Everything works fine until you set up Windows Authentication. Then it blows up. The problem is that the binding has to be configured to work with Windows Authentication. Let's first look at the endpoint in the web.config file. Take a look at the binding attribute. It should say "webHttpBinding". WebHttpBinding means that your web service responds to HTTP requests. This is necessary because this is the only way jQuery can call your service. In fact, I believe Visual Studio sets it in this way when you added the AJAX Enabled WCF Service rather than a plain old WCF Service. However there is no configuration for the WebHttpBinding itself, which means it just uses its default configuration which I believe is configured to use anonymous authentication. So we need to configure the WebHttpBinding to use Windows Authentication by putting the following nodes inside the system.servicemodel node:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment