네트워크의 여러 서버에서 여러 IIS 설치를 관리 할 수있는 작은 웹 응용 프로그램을 작성하는 중입니다. 도메인 컨트롤러가 없습니다.ADSI/IIS 관리 및 ASP.NET 위장
win32 API와 해당 LogonUser 메서드를 사용하는 작은 가장 컨트롤러를 작성했습니다. 그런 다음 System.DirectoryServices와 IIS ADSI 공급자를 사용하여 새 사이트를 만듭니다.
나는 다음과 같은 루틴 (가독성을위한 일반 텍스트 문자열 일부 값을 교환) 한 : if (impersonationSvc.ImpersonateValidUser("[email protected]", String.Empty, "PASSWORD))
{
string metabasePath = "IIS://" + server.ComputerName + "/W3SVC";
DirectoryEntry w3svc = new DirectoryEntry(metabasePath, "Administrator", "PASSWORD");
string serverBindings = ":80:" + site.HostName;
string homeDirectory = server.WWWRootNetworkPath + "\\" + site.FolderName;
object[] newsite = new object[] { site.Name, new object[] { serverBindings }, homeDirectory };
object websiteId = (object)w3svc.Invoke("CreateNewSite", newsite);
int id = (int)websiteId;
impersonationSvc.UndoImpersonation();
}
내가 웹 응용 프로그램이 (SRV6)에서 호스팅하는 서버를 사용하여이 루틴 작품. 새 사이트가 만들어집니다. 내가 예를 들어 SRV5를 사용하는 경우
, 우리의 네트워크에있는 다른 서버는 (아무 도메인 포함), ImpersonateValidUser 작동의하여 DirectoryEntry가 생성되지만 w3svc.Invoke 다음과 같은 오류와 함께 실패합니다
[COMException (0x80070005입니다) : 액세스
System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +377678
System.DirectoryServices.DirectoryEntry.Bind() +36
System.DirectoryServices.DirectoryEntry.get_NativeObject() +31
System.DirectoryServices.DirectoryEntry.Invoke(String methodName, Object[] args) +53
...
사람은 내가이 문제를 해결할 수있는 방법을 알고있다] 거부?
너는 맞다 .. 너무 많은 커피 – kitsune