It gives <span style="color:#FF0000">internal server error (500)</span> from
TimezoneHelper.GetWindowsTimeZoneInfos()
function under
GetWindowsTimezones()
in TimeZoneService.cs class.
Please help me with this.
19 Answer(s)
-
0
Hi,
You have to update your ABP packages.
In ABP Abp.Timing.Timezone.TimezoneHelper class fixed.
And in AspNet Zero TimingAppService and TimeZoneService is fixed.See the GitHub issue: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/3223">https://github.com/aspnetboilerplate/as ... ssues/3223</a>
-
0
Could you please be specific about the packages to be updated and the version.
I upgraded TimeZoneCoverter to 2.3.2, as mentioned in the github issue, but it did not resolve the error I am getting.
-
0
@cpadmin,
Updating nuget packages (all ABP packages to 3.5 and TimeZoneCoverter to 2.3.2) might not solve your problem.
Can you share your existing ABP nuget package version and AspNet Zero version ?Thanks.
-
0
Hi,
ABP version:<span style="color:#40BF80"> 3.4.0</span>
AspNet Zero version: <span style="color:#40BF40">5.1.0</span> -
0
Then, probably I think your problem is related to <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/903">https://github.com/aspnetzero/aspnet-ze ... issues/903</a>.
Can you try to apply the fix ? -
0
I am sorry but the link seems to be broken. It says <span style="color:#FF0040">404 not found</span>
-
0
Hi,
Please add your github username on "Github Users" tab in this page <a class="postlink" href="https://aspnetzero.com/LicenseManagement">https://aspnetzero.com/LicenseManagement</a>.
Then accept github invitation and try to visit the link again.If you don't receive an invitation email from github, please visit below address to accept invitation <a class="postlink" href="https://github.com/orgs/aspnetzero">https://github.com/orgs/aspnetzero</a>.
-
0
Hi,
By looking into the resolution of the issue, mentioned by you, I can deduce that the definition of the GetWindowsTimezones method, in my version of ABP, is up-to-date:public List GetWindowsTimezones() { return TimezoneHelper.GetWindowsTimeZoneInfos().OrderBy(tz => tz.BaseUtcOffset) .Select(tz => new NameValueDto { Value = tz.Id, Name = tz.DisplayName }).ToList(); }
I can also see that the lodger of the thread was able to retrieve Timezones even when he was using -version 5.0.0. Then what could possibly go wrong in my version of ABP and ASP.NET Zero?
-
0
It has to do something with TimingAppService as I can see from the Audit Log.
The log says:
System.InvalidTimeZoneException: "Aleutian Standard Time" was not recognized as a valid IANA time zone name, or has no equivalant Windows time zone.
What to do now?
-
0
Hi @cpadmin,
Can you share your project via email ?
It will be easier to check it like that.Thanks.
-
0
I am very sorry but I cannot share the project with you as it is client's property. But if you want I can share you the Audit logs related to Timezone.
-
0
No problem. Can you share TimingAppService.cs and TimeZoneService.cs ?
-
0
TimeZoneService.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Abp.Application.Services.Dto; using Abp.Configuration; using Abp.Dependency; using Abp.Timing; using Abp.Timing.Timezone; using TimeZoneConverter; namespace PhoneBook.PhoneBookProjects_Demo.Timing { public class TimeZoneService : ITimeZoneService, ITransientDependency { readonly ISettingManager _settingManager; readonly ISettingDefinitionManager _settingDefinitionManager; public TimeZoneService( ISettingManager settingManager, ISettingDefinitionManager settingDefinitionManager) { _settingManager = settingManager; _settingDefinitionManager = settingDefinitionManager; } public async Task GetDefaultTimezoneAsync(SettingScopes scope, int? tenantId) { if (scope == SettingScopes.User) { if (tenantId.HasValue) { return await _settingManager.GetSettingValueForTenantAsync(TimingSettingNames.TimeZone, tenantId.Value); } return await _settingManager.GetSettingValueForApplicationAsync(TimingSettingNames.TimeZone); } if (scope == SettingScopes.Tenant) { return await _settingManager.GetSettingValueForApplicationAsync(TimingSettingNames.TimeZone); } if (scope == SettingScopes.Application) { var timezoneSettingDefinition = _settingDefinitionManager.GetSettingDefinition(TimingSettingNames.TimeZone); return timezoneSettingDefinition.DefaultValue; } throw new Exception("Unknown scope for default timezone setting."); } public List GetWindowsTimezones() { return TimezoneHelper.GetWindowsTimeZoneInfos().OrderBy(tz => tz.BaseUtcOffset) .Select(tz => new NameValueDto { Value = tz.Id, Name = tz.DisplayName }).ToList(); } } }
TimingAppService.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Abp.Application.Services.Dto; using Abp.Configuration; using PhoneBook.PhoneBookProjects_Demo.Timing.Dto; namespace PhoneBook.PhoneBookProjects_Demo.Timing { public class TimingAppService : PhoneBookProjects_DemoAppServiceBase, ITimingAppService { private readonly ITimeZoneService _timeZoneService; public TimingAppService(ITimeZoneService timeZoneService) { _timeZoneService = timeZoneService; } public async Task> GetTimezones(GetTimezonesInput input) { var timeZones = await GetTimezoneInfos(input.DefaultTimezoneScope); return new ListResultDto(timeZones); } public async Task> GetTimezoneComboboxItems(GetTimezoneComboboxItemsInput input) { var timeZones = await GetTimezoneInfos(input.DefaultTimezoneScope); var timeZoneItems = new ListResultDto(timeZones.Select(e => new ComboboxItemDto(e.Value, e.Name)).ToList()).Items.ToList(); if (!string.IsNullOrEmpty(input.SelectedTimezoneId)) { var selectedEdition = timeZoneItems.FirstOrDefault(e => e.Value == input.SelectedTimezoneId); if (selectedEdition != null) { selectedEdition.IsSelected = true; } } return timeZoneItems; } private async Task> GetTimezoneInfos(SettingScopes defaultTimezoneScope) { var defaultTimezoneId = await _timeZoneService.GetDefaultTimezoneAsync(defaultTimezoneScope, AbpSession.TenantId); var defaultTimezone = TimeZoneInfo.FindSystemTimeZoneById(defaultTimezoneId); var defaultTimezoneName = $"{L("Default")} [{defaultTimezone.DisplayName}]"; var timeZones = _timeZoneService.GetWindowsTimezones(); timeZones.Insert(0, new NameValueDto(defaultTimezoneName, string.Empty)); return timeZones; } } }
-
0
Hi,
In TimingAppService.cs, there is a line;
var defaultTimezone = TimeZoneInfo.FindSystemTimeZoneById(defaultTimezoneId);
You need to change it to;
var defaultTimezone = _timeZoneService.FindTimeZoneById(defaultTimezoneId);
-
0
It says: <span style="color:#FF0000">'ITimeZoneService' does not contain a definition for 'FindTimeZoneById'</span>
-
0
Hi,
Here is the ITimeZoneService's latest version
<a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Core/Timing/ITimeZoneService.cs">https://github.com/aspnetzero/aspnet-ze ... Service.cs</a>and here is the TimeZoneService's latest version
<a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Core/Timing/TimeZoneService.cs">https://github.com/aspnetzero/aspnet-ze ... Service.cs</a>Please add the related method to your interface and it's implementation
-
0
Even after making the given changes I am still getting the same error:
<span style="color:#FF0000">System.InvalidTimeZoneException: "Aleutian Standard Time" was not recognized as a valid IANA time zone name, or has no equivalant Windows time zone.</span> -
0
Hello,
I had the similar issue. is your windows up to date it happened to me when I turn off the windows updates maybe that can be the problem ? -
0
@cpadmin, are there any records on your AbpSettings table with the value of "Aleutian Standard Time" ?
If not, we can arrange a remote meeting to solve your problem for the next week.