In my controller I have the following code:
public ActionResult Syslogs(string IPAddress) {
IEnumerable<Syslogd> syslogs = db.Syslogds.Take(100).ToList();
if (!String.IsNullOrEmpty(IPAddress)) {
syslogs = db.Syslogds.Where(s => s.MsgHostname == IPAddress).Take(100).ToList();
}
return View(syslogs.ToList());
}
The query times out whenever I pass a certain value to the IPAddress
variable. I'm not sure why that is happening or how I can prevent it. Does the value not exist in the database or is it just taking a long time to find it? Here is the error message I receive:
An exception of type 'System.Data.Entity.Core.EntityCommandExecutionException' occurred in EntityFramework.SqlServer.dll but was not handled in user code
Additional information: An error occurred while executing the command definition. See the inner exception for details.
The inner exception:
{"Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."}