Base solution for your next web application
Open Closed

Timezone not working on AWS Linux server #4112


User avatar
0
ideazco created

Hi,

We hosted our application on AWS EC2 Linux server with your support. Now we're getting a new error when change the timezone.

Here is the error logged on Logs.txt file

ERROR 2017-11-01 12:47:59,078 [12 ] Mvc.ExceptionHandling.AbpExceptionFilter - Unable to map Asia/Singapore to iana timezone. System.Exception: Unable to map Asia/Singapore to iana timezone. at Abp.Timing.Timezone.TimezoneHelper.WindowsToIana(String windowsTimezoneId) at Abp.Web.Configuration.AbpUserConfigurationBuilder.<GetUserTimingConfig>d__22.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Web.Configuration.AbpUserConfigurationBuilder.<GetAll>d__13.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.<GetAll>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at lambda_method(Closure , Object ) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__14.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextExceptionFilterAsync>d__23.MoveNext()

We're kindly looking for a solution for this error ASP

Thanks.


12 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @ideazco,

    Normally, windows timezone Ids must be saved to database as user settings but in your case it seems like IANA Ids are saved. Can you check that in your database ? Also please check that if the Id values are IANA or Windows for timezone selection comboboxes ?

  • User Avatar
    0
    ideazco created

    Hi,

    In the database in abpSettings table under 'Abp.Timing.TimeZone' raw it saves IANA time zone id. In the drop down it loads IANA time zone.

    Note: Hosting environment is AWS Linux.

    Please let us know if there any guidance to resolve this issue.

    Thanks & Regards Ideazco.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @ideazco,

    Do you use ASP.NET Core or ASP.NET MVC 5.x version ? Combobox value must be windows timezone Id actually. That is the cause of your problem.

  • User Avatar
    0
    ideazco created

    Hi,

    We're using ASP.NET Core + Angular version But we didn't change anything to timezone related files.

    Please let us know if there any guidance to resolve this issue.

    Thanks & Regards Ideazco.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I just checked our ASP.NET Core & Angular template and it seems like all three screens (host settings, tenant settings and my settings) pages contains correct values for timezone-combo component.

    Can you check that in your angular app's generated source ? If you cannot solve this problem, please send your project to us via email.

    Thanks.

  • User Avatar
    0
    ideazco created

    Hi,

    In all three screens in our project the combo-component generated as below attachment.

    Can I know this this error trigered in our code or Abp code ? If in our code then how fix this issue ?

    Below I mentioned the url and login details to the host

    <a class="postlink" href="http://ec2-13-229-110-146.ap-southeast-1.compute.amazonaws.com">http://ec2-13-229-110-146.ap-southeast- ... zonaws.com</a> Username : Admin Password: ideazco@123

    Thanks.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @,

    I just checked your website and server returns IANA names as values instead of Windows Timezone Names. Can you compare this method <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/master/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Application/Timing/TimingAppService.cs#L43">https://github.com/aspnetzero/aspnet-ze ... ice.cs#L43</a> with your version. It is in TimingAppService.

    If it is the same, can you share your ABP version ?

  • User Avatar
    0
    ideazco created

    Hi,

    There is no change except namesapces.

    ABP version is 3.0.0

    Thanks.

  • User Avatar
    0
    ismcagdas created
    Support Team

    @ideazco can you share your project with us for reviewing it ?

  • User Avatar
    0
    ideazco created

    Hi,

    Please check your emails (<a href="mailto:[email protected]">[email protected]</a>), we shared our source code with you and you can download the source code using the likn we gave there.

    We changed our AWS instance to Ubuntu, but we still getting the error...

    Please help us to resovle this issue...

    Thanks.

  • User Avatar
    0
    JeffMH created

    This is a cross platform issue with .Net. TimeZoneInfo.GetSystemTimeZones() returns different time zones between different OS platforms. There is no built in mapping between those in the .Net framework. My guess is this will be tough to fix without totally getting away from TimeZoneInfo class (EDIT: Fix may be the wrong word here lol...it's working perfectly as coded :) )

    Here is a little bit of the talk on stackoverflow.

    <a class="postlink" href="https://stackoverflow.com/questions/41566395/timezoneinfo-in-net-core-when-hosting-on-unix-nginx">https://stackoverflow.com/questions/415 ... unix-nginx</a>

    Another link if you want to look at the code itself and see that the Unix flavor gets the IANA timezones:

    <a class="postlink" href="https://github.com/dotnet/coreclr/search?utf8=%E2%9C%93&q=PopulateAllSystemTimeZones&type=">https://github.com/dotnet/coreclr/searc ... ones&type=</a>

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @JeffMH,

    Thanks for detailed information. We have fixed this problem on this issue <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/667">https://github.com/aspnetzero/aspnet-ze ... issues/667</a> using this nuget package <a class="postlink" href="https://github.com/mj1856/TimeZoneConverter">https://github.com/mj1856/TimeZoneConverter</a>. It's owner is one of the most experienced gusy on datetimes :).