2010-04-18 2 views
4

설치 후 Windows 통합 인증을 사용하도록 설정해야하는 웹 서비스 프로젝트가 있습니다. 일반적으로 웹 서비스를 설치 한 다음 수동으로 IIS로 이동하여 상자에 Windows 통합 인증이 선택되어 있는지 확인하십시오. 코드를 통해이를 수행 할 수있는 방법이 있어야합니다. Installer 클래스를 사용하여 보았습니다. 이것은 사용할 수있는 것 같지만 IIS에서 프로그램 적으로 속성을 설정하는 데 아무 것도 발견하지 못했습니다..NET 웹 서비스에서 IIS의 Windows 통합 인증을 프로그래밍 방식으로 설정하는 방법은 무엇입니까?

답변

3
String applicationPath = String.Format("{0}/{1}", _server.Sites["Default Web Site"].Name, "AppName"); 

Configuration config = _server.GetApplicationHostConfiguration(); 

ConfigurationSection anonymousAuthenticationSection = config.GetSection("system.webServer/security/authentication/anonymousAuthentication", applicationPath); 

anonymousAuthenticationSection["enabled"] = false; 

ConfigurationSection windowsAuthenticationSection = config.GetSection("system.webServer/security/authentication/windowsAuthentication", applicationPath); 

windowsAuthenticationSection["enabled"] = true; 

_server.CommitChanges(); 
+0

IIS6에서 작동하나요? –

+1

"여기에 보호 된 내부 인덱서에 액세스 할 수 없습니다."라는 메시지가 있습니다. –

0

WebDeploy을 살펴보십시오. 이 기술은 MS에서 웹 응용 프로그램을 배포하도록 설계되었습니다. ;-)

관련 문제