The resource object with key '<key>' was not found.

by pinkbegemot 2. April 2013 15:22

One might run into this error after publishing a Web Application to IIS (7). This message actually means that ASP.NET simply can’t find the resource files, though the message text is somehow misleading.  There are comments on the Net, stating that simple copying the resource files to the appropriate folder solves the issue, but it doesn't. This might happen when you manually configure your deployed application to run in a Virtual Directory on IIS.

 SYMPTOMS

When you develop a web app in Visual Studio 2010 as a Web Project and debug it using local IIS, things work, as they should (hopefully). If you choose to use local IIS  7 and  run your application in a sub-folder of a main application (site) the Visual Studio’s function “Create Virtual Directory” will in fact create a sub-application on your IIS 7 and not a Virtual Directory. And your resource files will be found and used correctly.

 

But when you publish your application to the “WWWROOT” (or any other folder) you might come across a somewhat mysterious error message  “The resource object with key '<some key>' was not found”

 
RESOLUTION

  1. Make sure the required resource files are located in the “App_GlobalResources” folder of your application (can be the “App_LocalResources” as well)
  2. Make sure that the resource key in question is actually present in the resource files
  3. (and the winner is!) Make sure your application is configured as an Application  on IIS and not just as Virtual Directory

Change language