VB.NET LDAP authentication error: "The server is not operational" - vb.net

We have a VB.NET application that uses LDAP to authenticate users through Active Directory.
Never had an issue before but this afternoon my co-worker applied Windows Updates and restarted our domain controller (and AD server) and now whenever anyone tries to login and use the application they get the following error:
Error Number: -2147016646
Error Descr: The server is not operational.
Using the following code to authenticate:
Dim adEntry As New System.DirectoryServices.DirectoryEntry("LDAP://" & gsDomainName, sUserName, sPassword)
Dim adSearcher As New System.DirectoryServices.DirectorySearcher(adEntry)
adSearcher.SearchScope = DirectoryServices.SearchScope.OneLevel
Try
Dim adResults As System.DirectoryServices.SearchResult = adSearcher.FindOne
...
It fails on the adSearcher.FindOne piece of code.
The immediate window gives more detailed error information
A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in System.DirectoryServices.dll
Anyone have any ideas?
Things I've tried:
Flushing the DNS on the domain controller
Restarting the DHCP server
Restarting DNS services.
Thanks!

Related

Domain server with name could not be contacted. Either the server is down or domain name is incorrect. The LDAP server is unavailable

I am stuck with an issue. I am trying to connect to Ax2009 using wsdl url in postman. When i tried to access that url in browser i am able to access that but through postman i am getting LDAP error.
Error: Test connection failed. Reason: Domain server with name:ABC could not be contacted. Either the server is down or domain name is incorrect. The LDAP server is unavailable.
Code:
using (var context = new PrincipalContext(ContextType.Domain,AuthInfo.Domain))
Getting error on this first line.
Please suggest some solution for this issue.
Thanxs in advance.

Azure Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'null'

I wrote an app and I am trying upload it on Azure. The app runs ok locally and has a SQL Server database as the backend; the app is based off MVC.
When I try to access a page such as /person, I get this error:
Azure Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'null'.
Anyone ever dealt with such an error and how did you resolve it.
I have tried a few suggestions but none seems to work:
adding to config file
setting Persist Security Info=False to true
What is the best way to solve this?
On the app's data connection, the connection string had no userid. Adding a userid fixed the issue. Even though when the app was published with a proper connection string, the user id was empty.

SQL Server 2008 error 18456 state 58, Login failed for user "

I have a Visual Studio C++ project (unmanaged C++) in which I try to connect to a SQL Server 2008 instance on another machine in the LAN. I use TCP/IP. My connection string is:
"DRIVER={SQL Server Native Client 10.0};Server=tcp:169.254.204.232,1433;Network Library=DBMSSOCN;Initial Catalog=myDB;User ID=myDBUser;Password=myPassword;"
Important fact: I am able to successfully connect remotely to that instance with user id myDBUser and password myPassword using SSMS -- using SQL Authentication mode (and specifying TCP/IP in the connection options)! Also, once logged in I can successfully navigate the database myDB.
So yes, I have enabled Mixed mode authentication on my server.
Also note that the same code was successfully connecting when my instance was local and I was using Windows Authentication. In other words, what changed since this whole thing last worked is that I moved my server to another machine, am now using SQL Authentication, and therefore changed my connection string -- the code has otherwise not changed at all.
Here is the error message I get in my SQL Server 2008 instance's Server Logs:
Login failed for user ". Reason: An attempt to login using SQL Authentication failed. Server is configured for Windows Authentication only.
Error: 18456, Severity: 14, State: 58.
Notice that the user being quoted in that error message is blank, even though in my connection string I specify a non-blank user ID.
Other connection strings I tried that give the same result:
"DRIVER={SQL Server Native Client 10.0};Server=MACHINE2;Database=myDB;User ID=myDBUser;Password=myPassword;" (where MACHINE2 is the windows name of the machine hosting the sql server instance.)
I do not specify an instance name in the above connection string because my instance is installed as the default instance, not a named instance.
Any ideas on how to solve this?
UPDATE: I solved this problem it seems. Are you ready to find out how silly and totally unrelated that error message was?
In the connection string, I just changed "User ID" to "uid" and "Password" to "pwd", and now it works.
I now see "Connected successfully" in my SQL Server logs...
Try running SELECT SERVERPROPERTY('IsIntegratedSecurityOnly'); if it returns 1 is Windows Authentication if 0 Mixed. If it returns 1 is definitely Windows Authentication and there must be something else wrong.
I think I solved this problem by doing this...
right click on servername on object explorer -> Properties -> Security -> Changed server authentication to SQL server and Windows authentication mode -> click OK.
after that open server on object explorer -> Expand security -> Expand Login -> right click on your login -> properties -> type new password -> confirm password -> OK.
then disconnect your SQL and restart your system. then login SQL server 2008 with changed password in sql authentication mode.
Thanks :)
The answer: In the connection string, I just changed "User ID" to "uid" and "Password" to "pwd", and now it works. I now see "Connected successfully" in my SQL Server logs...

.Invoke(“SetPassword”, …) results in “RPC server is unavailable” error

I have a page to create new users in our active directory using VB.NET
I’m using the following code
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
This code worked fine in the past.
Now we’ve migrated our webserver to Windows Server 2008 R2 and IIS 7.5, and suddenly the code is not working anymore. (.net framework is 2.0 and cannot be changed)
The user is still created in our active directory, but the account is automatically disabled and the password is not set.
Investigating this issue shows that an exception is thrown at the line
.Invoke("setPassword", New Object() {strDefaultPassword})
Exception
The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
The user account which is used to connect to the AD is still the same and had domain admin rights.
Since nothing has changed to the code, I think there must be another reason why this is not working anymore? Firewall settings, IIS configuration,..?
Any ideas??
I know there is a similar case here Trying to create a new Active Directory user, Invoke("SetPassword",pwd) throws "The RPC server is unavailable"
, but this doesn’t help me out.
Check TCP/UDP 445 port is opened on your firewall.
To connect to an AD server from outside a domain, you need the following ports to be opened :
. TCP/UDP 389 (LDAP)
. TCP 3268 (GC)
. TCP/UDP 445 (SMB over IP)
DirectoryEntry.Invoke() requires AuthenticationType.Secure. What this means is that it needs to be able to authenticate the request via Kerberos or NTLM.
It attempts to use LDAPS (TCP 636) first, then falls back to CiFS (TCP445) if/when it times out or fails because of a missing or invalid certificate. If neither of these ports are open, it will fail with an "RPC Server unavailable" exception.

Reportviewer working in localsystem(remote database) but error in webserver

reportviwer working fine in localsystem
when i set reporturl path and remoteserverurl details
serverurl : http://sriventech.in/ReportServer
reportpath : /invoice.rdlc
and upload the website
it is displaying errror ::
The attempt to connect to the report server failed. Check your connection information and that the report server is a compatible version.
The request failed with HTTP status 404: Not Found.
is there any problem with webserver or my reportpath and serverrul details
Unless you are in Local Mode, you have to provide credentials to the reporting server to run reports. The generic 404 is probably masking an authentication error. Make sure you are in the correct Active Directory group if you are using integrated authentication. Otherwise the page should prompt you to log in.