Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 924731 - Last Review: December 3, 2007 - Revision: 1.2
Error message when you try to run a Web application that is built on the .NET Framework 2.0: "Unable to cast object"
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 '/appname' Application.
"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'."
Note In this error message,
appname 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).
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.
To resolve this problem, move the satellite assembly that
has a nonneutral culture to a subfolder of the Bin folder.
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("en-GB")]A satellite assembly that has a neutral culture contains the following
AssemblyCulture attribute.
[assembly: AssemblyCulture("")]
APPLIES TO
- Microsoft .NET Framework 2.0
| kbtshoot kbinfo kbprb KB924731 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate