title: WCF Service Datetime parse error on different clients
body: <p>I have an issue regarding consumption of a WCF service:</p>
  
  <p>Interface:</p>
  
  <pre><code>[OperationContract]
  [WebInvoke(Method = "POST",
      ResponseFormat = WebMessageFormat.Json,
      RequestFormat = WebMessageFormat.Json,
      UriTemplate = "list_LogUser")]
   DTO.Responses.List_LogUser list_LogUser(DTO.Requests.Token token);
  </code></pre>
  
  <p>Request:</p>
  
  <pre><code>public class Token
  {
      public string ApiToken { get; set; }
  }
  </code></pre>
  
  <p>Response:</p>
  
  <pre><code>public class List_LogUsuario
  {
      public List&lt;Select.LogUser&gt; LogUsers { get; set; }
  }
  </code></pre>
  
  <p>Class:</p>
  
  <pre><code>public class LogUser
  {
     public int IdLogUser { get; set; }
     public string User { get; set; }
     public string Action { get; set; }
     public string Class { get; set; }
     public DateTime Date { get; set; }
  }
  </code></pre>
  
  <p>Implementation:</p>
  
  <pre><code>public DTO.Responses.List_LogUser list_LogUser(DTO.Requests.Token token)
  {
      try
      {
          DTO.Responses.List_LogUsuario response = new DTO.Responses.List_LogUsuario();
  
          if (BBSessionManager.Instance.validateAPIKEY(token.ApiToken))
          {
              response.LogUsers = new List&lt;Select.LogUser&gt;();
              Select.LogUser l = new Select.LogUser();
  
              DataTable dt = new DataTable();
              SqlDataAdapter sda = new SqlDataAdapter();
              string ConnString = ConfigurationManager.ConnectionStrings[clientConnString].ConnectionString;
              using (SqlConnection SqlConn = new SqlConnection(ConnString))
              {
                  SqlConn.Open();
  
                  SqlCommand sqlCmd = new SqlCommand(spName, SqlConn);
                  sqlCmd.CommandType = CommandType.StoredProcedure;
                  sda.SelectCommand = sqlCmd;
                  sda.Fill(dt);
                  SqlConn.Close();
                  sqlCmd.Dispose();
                  sda.Dispose();
              }
  
              DataRow[] rows = dt.Select();
  
              for (int i = 0; i &lt; rows.Length; i++)
              {
                  l = Utils.logUser_parse(rows[i]);
                  response.LogUsers.Add(l);
              }
  
              response.Response = Constants.OK;
          }
          else
          {
              response.Response = Constants.ERROR;
          }
  
          return response;
      }
      catch (Exception ex)
      {
          ...
      }
  
  }
  </code></pre>
  
  <p>BD Parser:</p>
  
  <pre><code>public static Select.LogUser logUser_parse(DataRow r)
      {
          Select.LogUser l = new Select.LogUser();
          ...
          l.Date = DateTime.ParseExact(r["Date"].ToString(), "M/d/yyyy h:mm:ss ttt", CultureInfo.InvariantCulture);
          ...
  
          return l;
      }
  </code></pre>
  
  <p>I have tried using <code>CultureInfo.InvariantCulture</code> on <code>DateTime.ParseExact</code> but still no results. What is more curious is that when I locally run it on my laptop it works but from my office PC it gives me the ERROR. I tested it from two another laptops, one with no error another with same error. I do not know if I am not using DateTime.ParseExact  correctly or if I'm missing something else.</p>
  
  <p>StackTrace:</p>
  
  <blockquote>
    <p>System.FormatException: String was not recognized as a valid DateTime.
    at System.DateTimeParse.ParseExact(String s, String format,
    DateTimeFormatInfo dtfi, DateTimeStyles style)    at
    System.DateTime.ParseExact(String s, String format, IFormatProvider
    provider)</p>
  </blockquote>