Im using the hdinsight hadoop locally and after successfully running mapreduce jobs on the hdfs i am trying with hive, unfortunately i am getting errors when running the hive query when creating a table.
I got the following code from another stack solution as i am only running it locally and not using azure:
var db = new HiveConnection(
webHCatUri: new Uri("http://localhost:50111"),
userName: (string)"hadoop", password: (string)null);
// also tried command with no ; inside quotes
string command = "CREATE TABLE log4jLogs(t1 string, t2 string, t3 string," +
"t4 string, t5 string, t6 string, t7 string)" +
"ROW FORMAT DELIMITED FIELDS TERMINATED BY ' ';";
db.ExecuteHiveQuery(command).Wait();
This always throws an exception after a while of processing. the exception is:
System.AggregateException: One or more errors occurred. --->
System.NullReferenc eException: Object reference not set to an
instance of an object. at
System.Threading.Tasks.TaskAwaiter1.GetResult() at
Microsoft.Hadoop.Hive.HiveConnection.<ExecuteHiveQuery>d__2.MoveNext()
--- End of inner exception stack trace --- at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout,
CancellationTo ken cancellationToken) at
System.Threading.Tasks.Task.Wait() at
ConsoleApplication1.Program.CreateActorsTable() in
c:\Users\Administrator\ Documents\Visual Studio
2012\Projects\ConsoleApplication1\ConsoleApplication1\Pr ogram.cs:line
90
---> (Inner Exception #0) System.NullReferenceException: Object reference not se t to an instance of an object. at
System.Threading.Tasks.TaskAwaiter1.GetResult() at
Microsoft.Hadoop.Hive.HiveConnection.d__2.MoveNext()<---
I have checked the logs from hadoop in which i get the following:
java.io.IOException: Invalid status dir URI at
org.apache.hcatalog.templeton.tool.TempletonControllerJob$LaunchMapper.run(TempletonControllerJob.java:155)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:762)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:364) at
org.apache.hadoop.mapred.Child$4.run(Child.java:266) at
java.security.AccessController.doPrivileged(Native Method) at
javax.security.auth.Subject.doAs(Subject.java:396) at
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1136)
at org.apache.hadoop.mapred.Child.main(Child.java:260) Caused by:
java.net.URISyntaxException: Illegal character in authority at index
6: asv://{0}#{1}/6f8d3bc9-89a2-4e1d-9749-2805d31f05f0 at
java.net.URI$Parser.fail(URI.java:2810) at
java.net.URI$Parser.parseAuthority(URI.java:3148) at
java.net.URI$Parser.parseHierarchical(URI.java:3059) at
java.net.URI$Parser.parse(URI.java:3015) at
java.net.URI.(URI.java:577) at
org.apache.hcatalog.templeton.tool.TempletonUtils.addUserHomeDirectoryIfApplicable(TempletonUtils.java:227)
at
org.apache.hcatalog.templeton.tool.TempletonControllerJob$LaunchMapper.run(TempletonControllerJob.java:152)
... 7 more
I would love if anyone could point me in the right direction with this as i cannot work out why this is failing.
If you want to use hive connection first have to start the hive server. Hive server executables are residing in hdp/hive/bin. Using command prompt start the hiveserver2.exe . You can modify the Hive server configuration using hiveserver2.xml which is also residing in the same folder.
Related
This happens on ReportDocument.Export() for a PDF generation.
But only sporadically/randomly.
In the overall picture it's not that bad, 1 or 2 errors per day (+10k request), but still this bugs me.
2 different kinds of errors:
CrystalDecisions.CrystalReports.Engine.LogOnException: Database logon failed.
CrystalDecisions.CrystalReports.Engine.LogOnException: Error in File < Reportname >.rpt
Unable to connect: incorrect log on parameters
I see that these errors are quite common in the community, i've found lots of sites with solutions to these error, i've tried a lot of them, but none have worked so far (one exception i'll mention below).
Facts
Version used is 13.0.21.2533 (SAP Crystal Reports runtime engine for .NET Framework (32 and 64 bits))
The reports generated work in all environments (even prod)
Some reports randomly/sporadically fail. Although the same (request) report can be generated almost immediately working fine.
No report viewer.
The fact that they work in prod, for me, discards many of the proposed solutions. Regardless i tried/checked them.
No connection to DB, i'm passing a DataSet as the DataSource of the report (multiple tables inside)
I use an "Using" pattern/syntax. I also tried explicitly disposing on Finally (isntead of using)
finally
{
report.Database.Dispose();
report.Close();
report.Dispose();
}
Testing/Replicating
To be able to replicate the issue, i use SOAP UI to Load test the request (1 minute, 2 threads, as many (exactly the same) requests as possible) and from time to time, one fails.
Error 1. Database Logon failed
This one is partially solved, i changed from setting the datasource this way:
report.SetDataSource(rawData);
to setting it for each table in the datasource, more or less like this:
foreach (DataTable dataTable in rawData.Tables)
{
foreach (CrystalDecisions.CrystalReports.Engine.Table table in report.Database.Tables)
{
if (table.Name == dataTable.TableName)
{
table.SetDataSource(dataTable);
break;
}
}
}
This fix removes almost entirely this error, almost.
I need more aggressive Load testing to get it to fail once sporadically, while previously it failed ,once or twice, each and every time i load tested it.
Error 2. Error in File < Reportname >.rpt. Unable to connect: incorrect log on parameters
With the fix above, there are also few instances of this error (1 or 2 exceptions), also need more aggressive load testing to happen, but occurs more than the above one. before it failed 3 to 7 times per load test.
Errors
An exception is thrown:
>>>>> Exception details=CrystalDecisions.CrystalReports.Engine.LogOnException: Database logon failed.
---> System.Runtime.InteropServices.COMException: Database logon failed.
at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
--- End of inner exception stack trace ---
at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export()
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Export()
at < mynamespace >.RptUtil.GeneratePDF(DataSet rawData, ...
the other one
An exception is thrown:
>>>>> Exception details=CrystalDecisions.CrystalReports.Engine.LogOnException: Error in File <
report name >_{1E5E29F7-E5A2-43EA-90E5-D62ECAA19A01}.rpt:
Unable to connect: incorrect log on parameters. ---> System.Runtime.InteropServices.COMException: Error in File <
report name >_{1E5E29F7-E5A2-43EA-90E5-D62ECAA19A01}.rpt:
Unable to connect: incorrect log on parameters.
at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
--- End of inner exception stack trace ---
at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export()
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Export()
at < mynamespace >.RptUtil.GeneratePDF(DataSet rawData, ...
I have entity-frameWork.
I wrote query that get sequence. and I got this error.
the code:
var rawQuery = _contextORA.Database.SqlQuery<int>("select SEQ_ID.NEXTVAL from dual");
var task = rawQuery.SingleAsync();
int nextVal = task.Result;
return nextVal.ToString();
end I get this error
Message:
Message One or more errors occurred. stackTrace: at
System.Threading.Tasks.Task.ThrowIfExceptional(Boolean
includeTaskCanceledExceptions) at
System.Threading.Tasks.Task`1.GetResultCore(Boolean
waitCompletionNotification) InnerException :
System.InvalidCastException: Specified cast is not valid.
update
I got the error in the line
rawQuery.SingleAsync();
what can I do?
On the local computer it works for me. But when I distribute it to test server - it gets the error. (and I use the same DB in the local and in the test)
I searched a lot trying to find why am I getting this error but no help, can you please advise.
I am getting the following error when executing a linq query
var test = (Linq query).ToList<Testdata>();
System.Data.EntityException: An error occurred while closing the
provider connection. See the inner exception for details. --->
Devart.Data.Oracle.OracleException: OCI invalid handle.
at Devart.Data.Oracle.a1.c(Int32 A_0) at Devart.Data.Oracle.aq.d()
at Devart.Data.Oracle.OracleInternalConnection.a(Boolean A_0)
at Devart.Common.DbConnectionInternal.CloseInternalConnection()
at
Devart.Data.Oracle.OracleInternalConnection.CloseInternalConnection()
at Devart.Common.DbConnectionInternal.Close()
at Devart.Data.Oracle.OracleInternalConnection.Close()
at Devart.Common.DbConnectionBase.Close()
at Devart.Data.Oracle.OracleConnection.Close()
at System.Data.EntityClient.EntityConnection.StoreCloseHelper() ---
End of inner exception stack trace ---
at System.Data.EntityClient.EntityConnection.StoreCloseHelper()
at System.Data.EntityClient.EntityConnection.CloseHelper()
at System.Data.EntityClient.EntityConnection.Close()
at System.Data.Objects.ObjectContext.ReleaseConnection()
at System.Data.Common.Internal.Materialization.Shaper`1.Finally()
at
ystem.Data.Common.Internal.Materialization.Shaper`1.ObjectQueryNestedEnumerator.Dispose()
at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
Please send us a small test project and DDL/DML script for reproducing the issue in our environment. Also specify the versions of your Oracle Server and Oracle Client.
Issue was due to pool reaching max capacity
I'm struggling with an error message I'm getting from the NServiceBus.Host during startup and not sure where I'm going wrong. I initially encountered the problem within a large project but I seem to be able to reproduce this from scratch.
In VS2012, start with a new C# Class Library project, set for .NET 4.6.2. Then add NuGet packages - NServiceBus (6.0.0), NServiceBus.Host (7.0.1) and NServiceBus.NHibernate (7.2.0).
Then edit the EndpointConfiguration class to be as follows:
using NServiceBus.Features;
using NServiceBus.Persistence;
namespace NSB6_Pure
{
using NServiceBus;
public class EndpointConfig : IConfigureThisEndpoint
{
public void Customize(EndpointConfiguration endpointConfiguration)
{
//TODO: NServiceBus provides multiple durable storage options, including SQL Server, RavenDB, and Azure Storage Persistence.
// Refer to the documentation for more details on specific options.
endpointConfiguration.UsePersistence<NHibernatePersistence, StorageType.Timeouts>();
endpointConfiguration.DisableFeature<MessageDrivenSubscriptions>();
endpointConfiguration.DisableFeature<Sagas>();
// NServiceBus will move messages that fail repeatedly to a separate "error" queue. We recommend
// that you start with a shared error queue for all your endpoints for easy integration with ServiceControl.
endpointConfiguration.SendFailedMessagesTo("error");
// NServiceBus will store a copy of each successfully process message in a separate "audit" queue. We recommend
// that you start with a shared audit queue for all your endpoints for easy integration with ServiceControl.
endpointConfiguration.AuditProcessedMessagesTo("audit");
}
}
}
Then compile (in this case a debug build) and, from a command prompt, try to run NServiceBus.Host.exe in the bin\Debug directory. In my case, I get this output, most of it in Red:
2017-04-28 12:46:11.876 INFO DefaultFactory Logging to 'C:\blah\bin\Debug\' with level Info
2017-04-28 12:46:13.446 FATAL NServiceBus.LicenseManager Your license has expire
d! You can renew it at https://particular.net/licensing.
2017-04-28 12:46:13.561 ERROR NServiceBus.GenericHost Exception when starting en
dpoint.
System.InvalidOperationException: In order to use NServiceBus with NHibernate yo
u need to provide at least one connection string. You can do it via (in order of
precedence):
* specifying 'NServiceBus/Persistence/NHibernate/Saga' connection string for th
e Saga persister
* specifying 'NServiceBus/Persistence' connection string that applies to all pe
rsisters
* specifying 'NServiceBus/Persistence/connection.connection_string' or 'NServic
eBus/Persistence/connection.connection_string_name' value in AppSettings or your
NHibernate configuration file.
For most scenarios the 'NServiceBus/Persistence' connection string is the best o
ption.
at NServiceBus.Persistence.NHibernate.NHibernateConfigurationBuilder.Validate
ConfigurationViaConfigFile(Configuration configuration, String configPrefix) in
C:\BuildAgent\work\5135de308b2f3016\src\NServiceBus.NHibernate\Internal\NHiberna
teConfigurationBuilder.cs:line 130
at NServiceBus.Features.NHibernateStorageSession.Setup(FeatureConfigurationCo
ntext context) in C:\BuildAgent\work\5135de308b2f3016\src\NServiceBus.NHibernate
\SynchronizedStorage\NHibernateStorageSession.cs:line 45
at NServiceBus.Features.FeatureActivator.ActivateFeature(FeatureInfo featureI
nfo, List`1 featuresToActivate, IConfigureComponents container, PipelineSettings
pipelineSettings) in C:\Build\src\NServiceBus.Core\Features\FeatureActivator.cs
:line 194
at NServiceBus.Features.FeatureActivator.SetupFeatures(IConfigureComponents c
ontainer, PipelineSettings pipelineSettings) in C:\Build\src\NServiceBus.Core\Fe
atures\FeatureActivator.cs:line 57
at NServiceBus.InitializableEndpoint.<Initialize>d__1.MoveNext() in C:\Build\
src\NServiceBus.Core\InitializableEndpoint.cs:line 50
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
ification(Task task)
at NServiceBus.GenericHost.<Start>d__1.MoveNext() in C:\BuildAgent\work\fc89e
968acb99302\src\NServiceBus.Hosting.Windows\GenericHost.cs:line 48
2017-04-28 12:46:13.582 ERROR NServiceBus.Hosting.Windows.WindowsHost Start fail
ure
System.InvalidOperationException: In order to use NServiceBus with NHibernate yo
u need to provide at least one connection string. You can do it via (in order of
precedence):
* specifying 'NServiceBus/Persistence/NHibernate/Saga' connection string for th
e Saga persister
* specifying 'NServiceBus/Persistence' connection string that applies to all pe
rsisters
* specifying 'NServiceBus/Persistence/connection.connection_string' or 'NServic
eBus/Persistence/connection.connection_string_name' value in AppSettings or your
NHibernate configuration file.
For most scenarios the 'NServiceBus/Persistence' connection string is the best o
ption.
at NServiceBus.Persistence.NHibernate.NHibernateConfigurationBuilder.Validate
ConfigurationViaConfigFile(Configuration configuration, String configPrefix) in
C:\BuildAgent\work\5135de308b2f3016\src\NServiceBus.NHibernate\Internal\NHiberna
teConfigurationBuilder.cs:line 130
at NServiceBus.Features.NHibernateStorageSession.Setup(FeatureConfigurationCo
ntext context) in C:\BuildAgent\work\5135de308b2f3016\src\NServiceBus.NHibernate
\SynchronizedStorage\NHibernateStorageSession.cs:line 45
at NServiceBus.Features.FeatureActivator.ActivateFeature(FeatureInfo featureI
nfo, List`1 featuresToActivate, IConfigureComponents container, PipelineSettings
pipelineSettings) in C:\Build\src\NServiceBus.Core\Features\FeatureActivator.cs
:line 194
at NServiceBus.Features.FeatureActivator.SetupFeatures(IConfigureComponents c
ontainer, PipelineSettings pipelineSettings) in C:\Build\src\NServiceBus.Core\Fe
atures\FeatureActivator.cs:line 57
at NServiceBus.InitializableEndpoint.<Initialize>d__1.MoveNext() in C:\Build\
src\NServiceBus.Core\InitializableEndpoint.cs:line 50
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
ification(Task task)
at NServiceBus.GenericHost.<Start>d__1.MoveNext() in C:\BuildAgent\work\fc89e
968acb99302\src\NServiceBus.Hosting.Windows\GenericHost.cs:line 54
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
ification(Task task)
at NServiceBus.Hosting.Windows.WindowsHost.Start() in C:\BuildAgent\work\fc89
e968acb99302\src\NServiceBus.Hosting.Windows\WindowsHost.cs:line 33
And the bit I'm focussing on is here:
In order to use NServiceBus with NHibernate you need to provide at least one connection string. You can do it via (in order of precedence):
specifying 'NServiceBus/Persistence/NHibernate/Saga' connection string for the Saga persister
I've checked the NServiceBus code - this isn't a generic message. If the issue was the lack of config for Timeouts1, I'm sure it would be talking about it rather than Saga, since that part of the error message is parameterized.
But I don't want to use Sagas in this particular project. I'd have thought DisableFeature<Sagas> would be sufficient to indicate to NServiceBus that I don't want to use sagas here, but apparently not.
So why is NServiceBus trying to configure Saga storage and, more importantly, how do I stop it from doing so?
1Of course, I am expecting such an error to occur since I haven't done anything such as even adding an app.config to the class library yet. So even once the Saga issue is resolved, I'm expecting this code to still produce errors. Just hopefully ones I can work out how to fix for myself.
(The rationale behind my wanting to avoid configuring any storage is that the real work to do is to upgrade some existing endpoints that have dedicated databases for each feature (Timeouts/Subscriptions/Sagas) and although I've been recommending for a while that we ought to merge these databases, and could thus just configure a NServiceBus/Persistence database for each endpoint, that's not been approved. But I'm loath to add another database for some of these endpoints when they only use timeouts at present)
I'm Dennis van der Stelt, a developer at Particular Software, makers of NServiceBus. I replied on your support case already, but wanted to update this question as well, so that others can find this as well. Evk mentioned most of it already, I just wanted to mention the GH issue and the complete code.
The following code configuration makes sure it doesn't complain about the saga connectionstring.
endpointConfiguration.DisableFeature<NHibernateStorageSession>();
endpointConfiguration.DisableFeature<MessageDrivenSubscriptions>();
endpointConfiguration.DisableFeature<Sagas>();
endpointConfiguration.UsePersistence<NHibernatePersistence, StorageType.Timeouts>();
Then just provide a connectionstring for timeouts
<add name="NServiceBus/Persistence/NHibernate/Timeout" connectionString="server=.\sqlexpress;database=nservicebus; Trusted_Connection=True;" />
That will make it work properly and as expected.
The reason why disabling the NHibernateStorageSession is necessary is because it is a feature inside the persister that is enabled. More information can be found in a GitHub issue I've created based on this case, which can be found here.
I must admit I have not much knowledge about NServiceBus, I just feel obliged to try to help people with high reputation when they ask questions :) So I don't have an explanation why it works like this, only where it fails. In stack trace you can see NHibernateStorageSession.Setup, and NHibernateStorageSession is one of the features. So it fails when trying to activate that feature. Setup starts like this:
protected override void Setup(FeatureConfigurationContext context)
{
NHibernateConfiguration config = new NHibernateConfigurationBuilder(context.Settings, "Saga", new string[1]
{
"StorageConfiguration"
}).Build();
// the rest
}
Where second parameter is connection string suffix. In this case it is hardcoded to "Saga", and as you see - there is no check that Sagas feature is enabled or not. NHibernateConfigurationBuilder then tries to find a connection string for saga (or any more general connection string) and fails to do so with the exception message you observe.
So easy solution is to disable that feature via
endpointConfiguration.DisableFeature<NHibernateStorageSession>();
However you should take care of course and ensure functionality you need is not dependent on that feature. It's not entirely clear for me what this feature is for, and I didn't found any documentation for it (though of course its name tells us something about its purpose).
You can do it via (in order of precedence):
It just means the first point would take precedence over the other, if you need to set Saga, but otherwise just do one of the other points:
specifying 'NServiceBus/Persistence' connection string that applies to all persisters
specifying 'NServiceBus/Persistence/connection.connection_string' or 'NServiceBus/Persistence/connection.connection_string_name' value in AppSettings or your NHibernate configuration file.
For most scenarios the 'NServiceBus/Persistence' connection string is the best option.
So you are not required to setup Saga, but it looks like you will not avoid setting a connection string somewhere.
when i am executing following code it results an error please help me to resolve this.
class MySample
{
public static void Main()
{
string eventLogName = "Security";
string sourceName = "BTHUSB";
string machineName = "v.i.com";
EventLog eventLog;
eventLog = new EventLog();
eventLog.Log = eventLogName;
eventLog.Source = sourceName;
eventLog.MachineName = machineName;
foreach (EventLogEntry log in eventLog.Entries.Cast<EventLogEntry>().Reverse())// Entries.Cast<EventLogEntry>().Reverse
{
Console.WriteLine(") Entry type: {0} , Category: {1}, Data: {2}, ID: {3}, Source: {4} \n", log.EntryType, log.TimeWritten, log.EventID, log.InstanceId, log.Source);
}
}
}
Error is ,
Unhandled Exception: System.IO.IOException: The network path was not found.
at Microsoft.Win32.RegistryKey.Win32ErrorStatic(Int32 errorCode, String str)
at Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(RegistryHive hKey, String ma chineName)
at System.Diagnostics.EventLog.GetEventLogRegKey(String machine, Boolean writ able)
at System.Diagnostics.EventLog.Exists(String logName, String machineName)
at System.Diagnostics.EventLog.OpenForRead(String currentMachineName)
at System.Diagnostics.EventLog.GetEntryAtNoThrow(Int32 index)
at System.Diagnostics.EventLogEntryCollection.EntriesEnumerator.MoveNext()
at System.Linq.Enumerable.<CastIterator>d__aa`1.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source) at System.Linq.Enumerable.<ReverseIterator>d__99`1.MoveNext()
at event.MySample.Main() in E:\.net prep\.net examples\event\event\Program.cs :line 42
please help me to resolve this, in a machine name field how to enter the remote machine, when it have v.i.com , but that system name is v only.
If you look at your stack trace you can see the failure happens trying to open the remote registry key.
This means that the Remote Registry service is not running on the target machine. On v.i.com, open the services control panel (services.msc) and start the service called Remote Registry.
This service is normally set to have the startup type of Manual so is not started automatically. If you need to configure or access the event log remotely often, set this to start Automatic so that it's always available.
I'd assume the machineName "Venus.InsTIL.com" which you've specified is not contactable via this path. What's the UNC path to the machine? Have you verified the machine is otherwise contactable (ping, UNC file browse etc)?
What account is that code running with? It may not have permission to access the network. That will depend on the web service configuration.
Something else is that recent OS versions do not allow strictly local accounts to access administrative shares on other systems, and that will be the account again.
It is likely that you did connect to the other machine. I would expect that the error would be more like connection refused or invalid credentials if the connection failed. The fact that this exception is happening on a move next operation (see stack trace) implies that the code was reading through the list when it attempted to read an entry that was not there. My guess is that the entry had been there when the foreach command created its list, but not there when iterating through the list. I suspect the issue is that something is changing the data on you.