Я использую скрипт, который должен выходить прямо на 1400 записей из нашего LDAP (я дважды проверял, запустив тот же фильтр в Apache Directory Studio, и запрос успешно завершился). Выход будет использоваться как источник SSIS SQL. Я знаю, что ограничение на страницу для LDAP установлено на уровне 2000, но каждый раз, когда мы запускаем скрипт ниже, получаем следующее сообщение об ошибке «Превышен лимит размера». Может ли кто-нибудь увидеть, что можно изменить в нашем скрипте, чтобы преодолеть это сообщение об ошибке? Я попытался установить «request.SizeLimit = Integer.MaxValue» и попробовал «request.SizeLimit = 2000» сразу же после того, как сохраняется то же сообщение об ошибке «Превышен лимит размера». Любая помощь будет принята с благодарностью.VB.Net - LDAP: предел размера был превышен
Imports System
Imports System.Data
Imports System.Math
Imports System.DirectoryServices.Protocols
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
<Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute()> _
<CLSCompliant(False)> _
Public Class ScriptMain
Inherits UserComponent
Public Overrides Sub CreateNewOutputRows()
'Set ldap server string and port number that will be bound against
Dim con As New LdapConnection(New LdapDirectoryIdentifier("ldap.company.com:636"))
'Set the username and password of the service account used to bind against ldap.company.com
Dim credential As New System.Net.NetworkCredential("USERNAME", "PASSWORD")
'Enable SSL ring bind to ldap.company.com
con.SessionOptions.SecureSocketLayer = True
'Set authentication method used ring bind to ldap.company.com
con.AuthType = AuthType.Basic
'Pass along the credentials established earlier
con.Credential = credential
Using con
'Set what attributes to pull from ldap.company.com
Dim attributesToReturn As String() = New String() {"uid", "companyID", "givenName", "Nickname", "MiddleName1", "sn", "generationQualifier", "Degree", "displayName", "mail", "PSCareerC1", "PSCareerDescC1", "PSProgC1", "PSExpTermC1", "Affiliation", "PrimaryAffiliation", "PrincipalName", "telephoneNumber", "OrgUnit", "title"}
'Set the search scope and filter for the query against ldap.company.com
Dim request As New SearchRequest("OU=people,DC=company,DC=com", "(objectClass=person)", SearchScope.Subtree, attributesToReturn)
Dim response As SearchResponse = DirectCast(con.SendRequest(request, New TimeSpan(1, 0, 0, 0, 0)), SearchResponse)
'Send ldap bind request to ldap.company.com using the paramaters set above
con.Bind()
If response.Entries.Count > 0 Then
Dim counter As Integer = 0
'Enumerate through each entry, pulling each of the attributes requested
For Each entry As SearchResultEntry In response.Entries
OutputBuffer.AddRow()
Dim Affiliations(5) As String
Dim Title(5) As String
OutputBuffer.DN = entry.DistinguishedName.ToString()
Dim attributes As SearchResultAttributeCollection = entry.Attributes
For Each attribute As DirectoryAttribute In attributes.Values
For i As Integer = 0 To attribute.Count - 1
If TypeOf attribute(i) Is String Then
If attribute.Name = "uid" Then
'Set NetID to the uid attribute value from ldap.company.com
OutputBuffer.NetID = attribute(i).ToString()
ElseIf attribute.Name = "givenName" Then
'Set FirstName to the givenName attribute value from ldap.company.com
OutputBuffer.FirstName = attribute(i).ToString()
ElseIf attribute.Name = "Nickname" Then
'Set Nickname to the Nickname attribute value from ldap.company.com
OutputBuffer.Nickname = attribute(i).ToString()
ElseIf attribute.Name = "MiddleName1" Then
'Set MiddleName to the MiddleName1 attribute value from ldap.company.com
OutputBuffer.MiddleName = attribute(i).ToString()
ElseIf attribute.Name = "sn" Then
'Set LastName to the sn attribute value from ldap.company.com
OutputBuffer.LastName = attribute(i).ToString()
ElseIf attribute.Name = "generationQualifier" Then
'Set Suffix to the generationQualifier attribute value from ldap.company.com
OutputBuffer.Suffix = attribute(i).ToString()
ElseIf attribute.Name = "Degree" Then
'Set Degree to the Degree attribute value from ldap.company.com
OutputBuffer.Degree = attribute(i).ToString()
ElseIf attribute.Name = "displayName" Then
'Set DisplayName to the displayName attribute value from ldap.company.com
OutputBuffer.DisplayName = attribute(i).ToString()
ElseIf attribute.Name = "companyID" Then
'Set UniqueID to the companyID attribute value from ldap.company.com
OutputBuffer.UniqueID = attribute(i).ToString()
ElseIf attribute.Name = "mail" Then
'Set Email to the mail attribute value from ldap.company.com
OutputBuffer.Email = attribute(i).ToString()
ElseIf attribute.Name = "title" Then
OutputBuffer.Title = attribute(i).ToString()
If String.IsNullOrEmpty(Title(0)) Then
Title(0) = attribute(i).ToString()
OutputBuffer.Title = Title(0)
ElseIf String.IsNullOrEmpty(Title(1)) Then
Title(1) = attribute(i).ToString()
OutputBuffer.Title = Title(0) + ", " + Title(1)
ElseIf String.IsNullOrEmpty(Title(2)) Then
Title(2) = attribute(i).ToString()
OutputBuffer.Title = Title(0) + ", " + Title(1) + ", " + Title(2)
ElseIf String.IsNullOrEmpty(Title(3)) Then
Title(3) = attribute(i).ToString()
OutputBuffer.Title = Title(0) + ", " + Title(1) + ", " + Title(2) + ", " + Title(3)
ElseIf String.IsNullOrEmpty(Title(4)) Then
Title(4) = attribute(i).ToString()
OutputBuffer.Title = Title(0) + ", " + Title(1) + ", " + Title(2) + ", " + Title(3) + ", " + Title(4)
End If
ElseIf attribute.Name = "telephoneNumber" Then
'Set Telephone to the telephoneNumber attribute value from ldap.company.com
OutputBuffer.Telephone = attribute(i).ToString()
ElseIf attribute.Name = "PSCareerC1" Then
'Set PSCareerC1 to the PSCareerC1 attribute value from ldap.company.com
OutputBuffer.PSCareerC1 = attribute(i).ToString()
ElseIf attribute.Name = "PSCareerDescC1" Then
'Set PSCareerDescC1 to the PSCareerDescC1 attribute value from ldap.company.com
OutputBuffer.PSCareerDescC1 = attribute(i).ToString()
ElseIf attribute.Name = "PSProgC1" Then
'Set PSProgC1 to the PSProgC1 attribute value from ldap.company.com
OutputBuffer.PSProgC1 = attribute(i).ToString()
ElseIf attribute.Name = "PSExpTermC1" Then
'Set PSExpTermC1 to the PSExpTermC1 attribute value from ldap.company.com
OutputBuffer.PSExpTermC1 = attribute(i).ToString()
ElseIf attribute.Name = "PrimaryAffiliation" Then
'Set PrimaryAffiliation to the PrimaryAffiliation attribute value from ldap.company.com
OutputBuffer.PrimaryAffiliation = attribute(i).ToString()
ElseIf attribute.Name = "PrincipalName" Then
'Set PrincipalName to the PrincipalName attribute value from ldap.company.com
OutputBuffer.PrincipalName = attribute(i).ToString()
ElseIf attribute.Name = "OrgUnit" Then
'Set OrgUnit to the OrgUnit attribute value from ldap.company.com
OutputBuffer.OrgUnit = attribute(i).ToString()
ElseIf attribute.Name = "Affiliation" Then
If String.IsNullOrEmpty(Affiliations(0)) Then
Affiliations(0) = attribute(i).ToString()
OutputBuffer.Affiliations = Affiliations(0)
ElseIf String.IsNullOrEmpty(Affiliations(1)) Then
Affiliations(1) = attribute(i).ToString()
OutputBuffer.Affiliations = Affiliations(0) + ", " + Affiliations(1)
ElseIf String.IsNullOrEmpty(Affiliations(2)) Then
Affiliations(2) = attribute(i).ToString()
OutputBuffer.Affiliations = Affiliations(0) + ", " + Affiliations(1) + ", " + Affiliations(2)
ElseIf String.IsNullOrEmpty(Affiliations(3)) Then
Affiliations(3) = attribute(i).ToString()
OutputBuffer.Affiliations = Affiliations(0) + ", " + Affiliations(1) + ", " + Affiliations(2) + ", " + Affiliations(3)
ElseIf String.IsNullOrEmpty(Affiliations(4)) Then
Affiliations(4) = attribute(i).ToString()
OutputBuffer.Affiliations = Affiliations(0) + ", " + Affiliations(1) + ", " + Affiliations(2) + ", " + Affiliations(3) + ", " + Affiliations(4)
End If
End If
End If
Next
Next
counter = counter + 1
Next
End If
End Using
End Sub
End Class
Когда клиент LDAP устанавливает максимально допустимого размера в поисковом запросе, что значение не может быть больше, чем сервера размер ограничение. Если на сервере установлен предел размера 1000, то задание * запрашиваемого * размера ограничения не будет переопределять 1000. –
Спасибо, мы проверили, что для параметра SizeLimit на сервере установлено значение 2000, а результаты фильтра используется возврат около 1400 пользователей при запуске через Apache Directory Studio. Я согласен с тем, что PagedSearch, вероятно, будет необходимо, есть ли у вас какие-либо примеры для VB.net? Я могу только найти примеры на C#. – user2649567