Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Having a strange Issue with ASPNET Core Web Api.

I have setup the globalisation in the startup.cs I have set the cultures (well I believe!).

C#
public class Startup
{
  public void ConfigureServices(IServiceCollection services)
  {
    services.Configure<RequestLocalizationOptions>(Options =>
    {
      Options.DefaultRequestCulture = new <pre> Microsoft.AspNetCore.Localization.RequestCulture("en-GB");
               Options.SupportedCultures = new List<CultureInfo> { new CultureInfo("en-GB") };
    }

    //All other configuration options
  }

  public void Configure(IApplicationBuilder app, IHostingEnvironment env)
  {
    if(env.IsDevelopment())
    {
      //Set Dev Env
    }
    else
    {
      //Set Live Env
    }

    app.UseRequestLocalization();
    app.UseMVc(routes =>
    {
      routes.MapRoute(
                   name: "default",
                   template: "{controller}/{action=Index}/{id?}");
    }
  }
}


Now if I test locally using Visual Studio it will only accept UK Dateformats which is what is required. But if I deploy to our test environment, it will only accept US Dateformats which is something that I am trying to remove.

Can anyone point me in the right direction as I feel I have tried all of the obvious to me!

I have also ensured that the webserver being deployed to has United Kingdom as its locations and region etc.

Thanks
Simon

What I have tried:

All of the above is where I got it too.
Posted
Updated 19-Dec-18 23:36pm
v3

1 solution

Please don't answer, forgot to check my deployment worked successfully and it failed!!

Redeployed and verfied the API using postman and it works!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900