Using Windows Authenticated Service for Client Development in Visual Studio

I have a service hosted on a server. Service Authentication uses Windows Authentication. I want to use this service in my site development in Visual Studio 2010. When I try to add a link, it says the following error.

"Security settings for this service require Windows Authentication but it is not enabled for the IIS application that hosts this service."

      

What should I do to overcome this and be able to use the service for development?

Note. The error message is obvious. What I am looking for is the best way to overcome this.

Note. When I type in the address of a service in Mozilla Firefox, it asks for my Windows credentials - when I enter the credentials, it gives me descriptions of the services. The problem is I am using it through Visual Studio.


+3


source to share


1 answer


If you understand correctly, your service is already running successfully and using Windows Authentication, so in order for the calling application on your website to also use Windows Authentication.

When you try to add a link, VS will launch your site in the background using any web server defined in the Project Properties. You say that you start your site with an embedded web server (also known as Cassini or Webdev). You need to make sure your site is using Windows Authentication. You do this from the Project Project property (right click on the root folder and select Properties). There you will see a web tab with an NTLM authentication checkbox - make sure it is checked.

Also, make sure you are using:

<system.web>
   <authentication mode="Windows">
...

      

in your web.config.



However, if you want to use IIS itself, I assume you have it installed and know how to define a web application. Depending on which version of Windows you are using, you may or may not have IIS installed, or it may not be installed (using programs and components from Control Panel). If you don't have IIS, you can install IIS Express here: http://learn.iis.net/page.aspx/868/iis-express-overview/

Once you've installed IIS and identified your application root and pointed the directory to your local source folder, enable Windows Authentication (NTLM) for that web application / site. How you do this depends on which version of IIS you are using, but this is usually a click on the Identity icon. You probably need to turn off Anonymous and also turn on Windows Authentication so that all requests are forced into Windows Authentication. For browsers that do not support automatic NTLM authentication, I also enable Basic Forms authentication.

Once you have the IIS application installed, you can use it to debug Visual Studio instead of the built-in web server. You can also do this from Project Properties by selecting Use Local IIS Server and choosing the URL for the IIS site you created above. Additionally, VS can create an IIS site definition for you if it doesn't already exist.

Any of the above methods should ensure that when VS starts your site to add a link, it will use authentication as well at runtime. Please note that you can add the link manually without having to launch the site. Then, you just need to make sure that you are using Windows Authentication at runtime as described above.

+1


source







All Articles