【发布时间】:2010-07-26 06:32:07
【问题描述】:
我一直在摆弄 c# webservices 和 vbscript。如果我直接在网络服务器上通过 IE 手动触发服务,一切正常,但是当我尝试从 vbscript 运行相同的服务时,它会抛出“发生操作错误”。例外。
该服务非常简单,它所做的只是在 Active Directory 中创建一个计算机对象。
DirectoryEntry Container = new DirectoryEntry("LDAP://ldapgw/" + LDAPLocation);
DirectoryEntries ComputerOU = Container.Children;
DirectoryEntry ComputerObject = ComputerOU.Add("CN=" + ComputerName, "computer");
ComputerObject.InvokeSet("sAMAccountName", ComputerName);
ComputerObject.InvokeSet("description", "Reserved");
ComputerObject.InvokeSet("userAccountControl", 4128);
ComputerObject.CommitChanges();
它是这样触发的:
Set soap = CreateObject("Msxml2.XMLHTTP")
soap "POST", URL, false, username, password
soap.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
soap.setRequestHeader "SOAPAction", nsURL + service
soap.send xml
我猜这与权限有关,但我不知道是什么。我正在使用模拟,如果我输出WindowsIdentity.GetCurrent(),它似乎以正确的用户身份运行,该用户在 AD 中具有所需的权限。
有谁知道我做错了什么?
【问题讨论】:
标签: c# iis-7 vbscript web-services