Dim rootEntry As New DirectoryEntry
With rootEntry
.Path = "LDAP://" & strServer & "/" & strLDAP
.AuthenticationType = AuthenticationTypes.Secure
.Username = strServerUsername
.Password = strServerPassword
End With
Dim newUser As DirectoryEntry = rootEntry.Children.Add("CN=" & strCN, "user")
With newUser
.CommitChanges()
.Properties("userPrincipalName").Value = TextPN.Text
.Properties("sAMAccountName").Value = TextAlias.Text
.Properties("givenname").Value = TextGivenname.Text
.Properties("sn").Value = TextSurname.Text
……
.CommitChanges()
.Invoke("setPassword", New Object() {strDefaultPassword})
.CommitChanges()
.Properties("userAccountControl").Value = &H0001
.CommitChanges()
End With 我们的活动目录创建新用户
此代码在过去运行良好。 现在我们已经将我们的网络服务器迁移到Windows Server 2008 R2和IIS 7.5,并且代码突然不再工作了。 (.net framework为2.0,无法更改) 用户仍在我们的活动目录中创建,但该帐户被自动禁用,并且未设置密码。
调查这个问题显示,一个例外是在线抛出
.Invoke("setPassword", New Object() {strDefaultPassword})
异常
The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
其用于连接到AD的用户帐户仍然是相同的并具有域管理权利。 由于代码没有任何改变,我认为必须有另一个原因,为什么这不工作了?防火墙设置,IIS配置,..?
任何想法??