We have a software that connects to a cloud-drive. This software was already running for 2 years without problems on 2 different servers. On both server is running the exact same version of the software and both connect to the same drive with the same user credentials. Both servers use the Windows 10 Enterprise version.
Now they had to change the name of the network-drive from "\cloudserver-name\CentralEurope\path\to\directory" to "\domain-name\EU_Central\path\to\directory"
We changed this in the configuration of the software for both our servers. Now one can connect, while the other can't connect anymore. It throws a 1232 error (The network location cannot be reached. For information about network troubleshooting, see Windows Help).
If we try to connect via the windows explorer it works flawlessly on both servers, but still the one server cannot connect with the software.
As for the code, we are running this for the connection to the UNC-Path:
internal struct USE_INFO_2
{
internal LPWSTR ui2_local;
internal LPWSTR ui2_remote;
internal LPWSTR ui2_password;
internal DWORD ui2_status;
internal DWORD ui2_asg_type;
internal DWORD ui2_refcount;
internal DWORD ui2_usecount;
internal LPWSTR ui2_username;
internal LPWSTR ui2_domainname;
}
[DllImport("NetApi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern NET_API_STATUS NetUseAdd(
LPWSTR UncServerName,
DWORD Level,
ref USE_INFO_2 Buf,
out DWORD ParmError);
private Boolean netUseWithCredentials()
{
uint returncode;
try
{
USE_INFO_2 useinfo = new USE_INFO_2();
useinfo.ui2_remote = uncPath;
useinfo.ui2_username = user.username;
useinfo.ui2_domainname = user.domain;
useinfo.ui2_password = user.password;
useinfo.ui2_asg_type = 0;
useinfo.ui2_usecount = 1;
uint paramErrorIndex;
returncode = NetUseAdd(null, 2, ref useinfo, out paramErrorIndex);
prevError = (int)returncode;
if(prevError != 0)
Logger.logText("UNCAccess", "Fehler: Eine Verbindung zu " + uncPath + " konnte nicht aufgebaut werden: " + prevError + "," + paramErrorIndex + "!", true);
return returncode == 0;
}
catch(Exception ex)
{
prevError = Marshal.GetLastWin32Error();
Logger.log("UNCAccess", ex, "Fehler: Eine Verbindung zu " + uncPath + " konnte nicht aufgebaut werden: " + prevError + "!", 0);
return false;
}
}
So basically we get the returncode 1232 in the "returncode = NetUseAdd(null, 2, ref useinfo, out paramErrorIndex);" line.
As for the user/password/uncpath variables both servers are using exactly the same ones.
Does anybody know what could happen here?