title: Why does this error occure? dotnet core mvc localization
body: <p>I'm trying to localize my .Net Core 2.2 MVC Website and I created a test project and copy and pasted these instructions: <a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization?view=aspnetcore-2.2" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization?view=aspnetcore-2.2</a></p>
  
  <p>After that I tried getting the localized string and went on www.../Info/TestLoc</p>
  
  <p>InfoController:</p>
  
  <pre><code>public class InfoController : Controller
  {
      private readonly IStringLocalizer&lt;InfoController&gt; _localizer;
      private readonly IStringLocalizer&lt;SharedResource&gt; _sharedLocalizer;
  
      public InfoController(IStringLocalizer&lt;InfoController&gt; localizer,
                     IStringLocalizer&lt;SharedResource&gt; sharedLocalizer)
      {
          _localizer = localizer;
          _sharedLocalizer = sharedLocalizer;
      }
  
      public string TestLoc()
      {
          string msg = "Shared resx: " + _sharedLocalizer["Hello!"] +
                       " Info resx " + _localizer["Hello!"];
          return msg;
      }
  }
  </code></pre>
  
  <p>But I'm getting this error:</p>
  
  <blockquote>
    <p>An unhandled exception occurred while processing the request.
    InvalidOperationException: Unable to resolve service for type 'Microsoft.Extensions.Localization.IStringLocalizer`1[Localization.Controllers.InfoController]' while attempting to activate 'Localization.Controllers.InfoController'.</p>
  </blockquote>
  
  <p>Now I googled about that error and I found that this error occures when you aren't assigning a type. I'm doing that.</p>
  
  <p>I really am clueless right now because I just copy and pasted the whole microsoft tutorial and it won't work. </p>
  
  <p>I hope you guys understand my problem and I hope you can help me.</p>
  
  <p>Thanks in advance I really appreciate you taking your time to read this and help me. </p>
  
  <p>Greetings Nico aka Myridor</p>