Microsoft KB Archive/924731

= Error message when you try to run a Web application that is built on the .NET Framework 2.0: &quot;Unable to cast object&quot; =

Article ID: 924731

Article Last Modified on 12/3/2007

-

APPLIES TO


 * Microsoft .NET Framework 2.0

-



SYMPTOMS
When you try to run a Web application that is built on the Microsoft .NET Framework 2.0, you may receive an error message that resembles the following:

Server Error in '/ ' Application.

&quot;Unable to cast object of type 'System.Web.Compilation.BuildResultCompiledAssembly' to type 'System.Web.Util.ITypedWebObjectFactory'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.Compilation.BuildResultCompiledAssembly' to type 'System.Web.Util.ITypedWebObjectFactory'.&quot;

Note In this error message,  is a placeholder for the name of the Web application.

This problem occurs after you restart the Web application.

Note This problem may continue to occur even after you use the iisreset command to reset Microsoft Internet Information Services (IIS).



CAUSE
This problem is caused when a satellite assembly that has a nonneutral culture is located directly in the Bin folder of the Web application. Satellite assemblies must be located in a subfolder of the Bin folder. Additionally, satellite assemblies must have a name that is equal to the culture of the assembly, such as en-GB.



RESOLUTION
To resolve this problem, move the satellite assembly that has a nonneutral culture to a subfolder of the Bin folder.



MORE INFORMATION
You can determine whether a satellite assembly has a nonneutral culture by considering the AssemblyCulture attribute of the assembly. For example, a satellite assembly that has a specific culture contains an AssemblyCulture attribute that resembles the following. [assembly: AssemblyCulture(&quot;en-GB&quot;)] A satellite assembly that has a neutral culture contains the following AssemblyCulture attribute. [assembly: AssemblyCulture(&quot;&quot;)]

Keywords: kbinfo kbtshoot kbprb KB924731

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.