That looks like a globalization issue. The Azure servers will be using en-US
culture that expects the dates in mm/dd/yy
format for parsing.
But you are using UK date format dd/mm/yy
, so the culture is en-GB
. Your development machine will be set to use the en-GB
locale already, hence no problems when testing locally.
You can specify the culture in your web.config
:
<configuration>
<system.web>
<globalization uiCulture="en-GB" culture="en-GB" />
</system.web>
</configuration>
Or you can do so at runtime in global.asax
:
public void PreRequestHandlerExecute(object sender, EventArgs e)
{
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB");
}
Or you could modify how ServiceStack.Text deserializes DateTime
, but I wouldn't recommend that approach. In the AppHost
Configure
method:
JsConfig<DateTime>.DeSerializeFn = date => DateTime.ParseExact(date, "dd/MM/yy", CultureInfo.InvariantCulture);
Hope that helps.