Help: How to enable Windows Authentication on ASP.

2020-02-01 07:29发布

I hope any of you guys knows how to fix this issue we are having.

We are trying to host a WCF service via the web. We set the web.config to have the service require windows authentication. The problem we are having is the following:

When we host our service in a regular IIS, the service runs fine and there is no issues with the "Windows Authentication" mode. However, when we try to run it from our developer boxes we get the following error: "Security settings for this service require Windows Authentication but it is not enabled for the IIS application that hosts this service."

Our developers boxes are not hosting the service through the regular IIS but rather through Visual Studio's APS.NET Development Server. We tried going into the web project properties and said to enable NTLM authentication but that still did not fix it. Does anyone know how to fix it? Does VS ASP.NET Development Server even support Windows Authentication? Is the only option for hosting the service with Windows Authentication is to use IIS and forget about ASP.NET Development Server?

Thanks Chuck

4条回答
啃猪蹄的小仙女
2楼-- · 2020-02-01 07:39

I would install and configure IIS on your local dev machine and use that in preference to using the inbuilt webserver. To use local IIS to debug select "User Local IIS web server" on the web tab of the project properties. Using IIS rather than the inbuilt webserver also means that you can configure your app in exactly the same way as it will be configured on the production server and this will reduce the no of potential surprises when you move to the production environment.

查看更多
我欲成王,谁敢阻挡
3楼-- · 2020-02-01 07:43

In order to configure IIS Express security settings:

  1. look for the IIS express symbol in the taskbar (system tray).
  2. Right click and select "All Applications".
  3. Click on the name of the site you want to change (although I believe the change is site wide)
  4. Click on the path in the config section below (it will open the applicationhost.config file)
  5. Search for the authentication section and make your changes

Example changes can be found here:

http://toadcode.blogspot.ca/2011/08/security-config-in-iis-express.html

查看更多
时光不老,我们不散
4楼-- · 2020-02-01 07:48

The solution to my authorization issue was to go into the F4 project properties and set the following:

Anonymous Authentication: Disabled

Windows Authentication: Enabled

Apparently these properties update the IIS applicationHost.config directly.

http://provenstyle.com/blog/2015/10/02/Visual-Studio-2015-Windows-Authentication-And-IIS-Express/

查看更多
做个烂人
5楼-- · 2020-02-01 07:58

ASP.Net Development Server is very limited. It only serves requests originating from the same machine that it is running on, and it will not serve files that are outside of its application scope. It is based on the Cassini server. Cassini does not support WCF web services. Documentation for ASP.Net Development Server says that it does support NTLM. If you are just browsing to a page from the local machine it should work fine unless the page is referencing an unavailable resource.

check out http://msdn.microsoft.com/en-us/library/58wxa9w5.aspx for more info.

查看更多
登录 后发表回答