I finally started reading about SOA and am giving WCF a shot along with Azure cloud services. One thing I find particularly difficult is debugging. Say I create a service and deploy it to the web as an Azure cloud service and have errors, how do I check what those errors are? I currently have a service that accepts a plain old POCO and then adds data to two Azure databases. My operation contract method returns a bool indicating whether the CRUD statements failed or passed. I keep getting a false bool back but have no way of stepping into code or logging each code line with a logging method.
public bool SubmitSupportRequest(SupportRequestPacket packet)
{
bool status;
//convert SupportRequestPacket to entities
var ameeEntity = new AccuDb_Entities.SupportTicket();
var preferedEntity = new AccuDb_Entities.Support_Requests();
//ameeEntity will be depreciated soon. Moving all support requests to Accu_Db (second entity)
ameeEntity.Client = packet.Client;
ameeEntity.Date = packet.Date;
ameeEntity.Description = packet.Description;
ameeEntity.FirstName = !string.IsNullOrEmpty(packet.FirstName) ? packet.FirstName : "None Provided";
ameeEntity.Ip = !string.IsNullOrEmpty(packet.IP) ? packet.IP : "None Provided";
ameeEntity.LastName = !string.IsNullOrEmpty(packet.LastName) ? packet.LastName : "None Provided";
ameeEntity.MachineName = packet.MachineName;
ameeEntity.ProblemFrequency = packet.ProblemFrequency;
ameeEntity.TypeOfProblem = packet.TypeOfProblem;
preferedEntity.Client = packet.Client;
preferedEntity.Date = packet.Date;
preferedEntity.Description = packet.Description;
preferedEntity.FirstName = !string.IsNullOrEmpty(packet.FirstName) ? packet.FirstName : "None Provided";
preferedEntity.Ip = !string.IsNullOrEmpty(packet.IP) ? packet.IP : "None Provided";
preferedEntity.LastName = !string.IsNullOrEmpty(packet.LastName) ? packet.LastName : "None Provided";
preferedEntity.MachineName = packet.MachineName;
preferedEntity.ProblemFrequency = packet.ProblemFrequency;
preferedEntity.TypeOfProblem = packet.TypeOfProblem;
using (var tempContext = new AccuDb_Entities.ameesupporttickets_dbEntities())
{
try
{
tempContext.SupportTickets.Add(ameeEntity);
tempContext.SaveChanges();
status = true;
}
catch
{
status = false;
return status;
}
}
using (var context = new AccuDb_Entities.Accu_DbEntities())
{
try
{
context.Support_Requests.Add(preferedEntity);
context.SaveChanges();
status = true;
}
catch
{
status = false;
}
}
return status;
}