title: Run Console application On server(IIS 7 & Windows Server 2003)
body: <p>I Have Created a Console Application Using C# .net and it's working fine on my local system but when i am copying bin folder to Server and running .exe file noting happens(a black screen Comes and Disappear in a second) I have checked on Sql Server Profiler Everything working fine I Have Used Try Catch Block to check exception but nothing works ..... 
  my Code is </p>
  
  <pre><code> private static void Main(string[] args)
      {
          try
          {
              // Get All User
              var userList = BLLMailAlert.GetAllSubscribedUser();
              // Send UserID as Parameter and Find Tenders For Users
              var InCulture = new CultureInfo("hi-IN");
              var currentDate = DateTime.Now;
              var fromEmail = string.Empty;
              var toEmail = string.Empty;
              foreach (var user in userList)
              {
                  // For Each AlertId Find Template Name and EmailId
                  var userDetail = BLLMailAlert.GetUserAllDetail(user.AlertID);
                  var userTenders = BLLMailAlert.GetAllTenderForPaidUser(user.UserID).ToList();
                  if (userTenders.Count &gt; 0)
                  {
                      // According to TemplatePath Send tender Alert to each user 
                      var TemplatePath = userDetail.UserTypeTemplate.EmailTemplatePath;
                      var HeaderTemplateForPaidUser = ConfigurationManager.AppSettings["HeaderTemplateForPaidUser"];
                      var FooterTemplateForPaidUser = ConfigurationManager.AppSettings["FooterTemplateForPaidUser"];
                      toEmail = userDetail.Email;
                      fromEmail = ConfigurationManager.AppSettings["AdminMail"];
                      var sbMail = new StringBuilder();
                      using (var sReader = new StreamReader(HeaderTemplateForPaidUser))
                      {
                          sbMail.Append(sReader.ReadToEnd());
                          sbMail.Replace("{Name}", userDetail.Name);
                          sbMail.Replace("{CurrentDate}", currentDate.ToString("D"));
                      }
  
                      foreach (var tender in userTenders)
                      {
                          using (var sReader = new StreamReader(TemplatePath))
                          {
                              sbMail.Append(sReader.ReadToEnd());
                              sbMail.Replace("{TenderTitle}", tender.TenderTitle);
                              sbMail.Replace("{TenderID}", tender.TenderID.ToString("####"));
                              sbMail.Replace("{TenderType}", tender.TenderTypeName);
                              sbMail.Replace("{TenderValue}", tender.TenderValue.ToString("₹ 0,0", InCulture));
                              sbMail.Replace("{TenderEMD}", tender.TenderEMD);
                              sbMail.Replace("{Location}", tender.Location);
                              sbMail.Replace("{OrgName}", tender.OrgName);
                              sbMail.Replace("{LastDateForSubmission}", tender.LastDateForSubmission.ToString("d"));
                              sbMail.Replace("{SubProductCatName}", tender.SubProductCatName);
                              sbMail.Append("&lt;br /&gt;");
                          }
                      }
  
                      using (var sReader = new StreamReader(FooterTemplateForPaidUser))
                      {
                          sbMail.Append(sReader.ReadToEnd());
                      }
  
                      var mailReport = BLLMailAlert.SendTenderAlert(fromEmail, toEmail, sbMail.ToString());
                      if (mailReport)
                      {
                          Console.WriteLine("Tender Alert Send " + currentDate);
                          Console.WriteLine("Press enter 1...");
                          Console.ReadLine();
                          // using (var writer = new StreamWriter("log.txt"))
                          // {
                          // writer.WriteLine("Tender Alert Send" + currentDateTime);
                          // }
                      }
                      else
                      {
                          Console.WriteLine("Unable To Send Tender Alert" + currentDate);
                          Console.WriteLine("Press enter 2...");
                          Console.ReadLine();
                          // using (var writer = new StreamWriter("log.txt"))
                          // {
                          // writer.WriteLine("Unable To Send Tender Alert" + currentDateTime);
                          // }
                      }
                  }
                  else
                  {
                      Console.WriteLine("No Tender Found" + currentDate);
                      Console.WriteLine("Press enter 3...");
                      Console.ReadLine();
                  }
              }
          }
          catch (Exception ex)
          {
              Console.Write(ex);
              Console.WriteLine("Press enter 4...");
              Console.ReadLine();
          }
      }
  </code></pre>
  
  <p>I have tried by Writting Console.WriteLine("Hey Vishal");
  in main but it's still not working</p>