title: No service for type 'Microsoft.AspNetCore.Mvc.Localization.IHtmlLocalizer' has been registered
body: <p>I try with ASP.Core to have a multilanguages website. So, I have in my StartUp.cs:</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      services.AddLocalization();
      services.Configure&lt;RequestLocalizationOptions&gt;(
      opts =&gt;
      {
          var supportedCultures = new[]
          {
              new CultureInfo("de-DE"),
              new CultureInfo("de"),
              new CultureInfo("fr-FR"),
              new CultureInfo("fr"),
          };
          opts.DefaultRequestCulture = new RequestCulture("fr-FR");
          // Formatting numbers, dates, etc.
          opts.SupportedCultures = supportedCultures;
          // UI strings that we have localized.
          opts.SupportedUICultures = supportedCultures;
      });
      // Add framework services.
      services.AddDbContext&lt;ApplicationDbContext&gt;(options =&gt; options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
      services.AddIdentity&lt;ApplicationUser, IdentityRole&gt;()
          .AddEntityFrameworkStores&lt;ApplicationDbContext&gt;()
          .AddDefaultTokenProviders();
      services.AddMvc();
      // Add application services.
      services.AddTransient&lt;IEmailSender, AuthMessageSender&gt;();
      services.AddTransient&lt;ISmsSender, AuthMessageSender&gt;();
  }
  </code></pre>
  
  <p>In my _ViewImports.cs I have:</p>
  
  <pre><code>@using System.Threading.Tasks
  @using Microsoft.AspNetCore.Builder
  @using Microsoft.AspNetCore.Localization
  @using Microsoft.AspNetCore.Mvc.Localization
  @using Microsoft.Extensions.Options
  
  @inject IHtmlLocalizer Localizer
  @inject IOptions&lt;RequestLocalizationOptions&gt; LocOptions
  @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
  </code></pre>
  
  <p>The errors:</p>
  
  <pre><code>An unhandled exception occurred while processing the request.
  
  InvalidOperationException: No service for type 'Microsoft.AspNetCore.Mvc.Localization.IHtmlLocalizer' has been registered.
  </code></pre>