Unable to cast HttpApplication to type WebClientApplication

Topics: User Forum, Web Client Software Factory
Apr 11, 2013 at 8:05 AM

I am getting a server error when I tried to load a page that was deployed in server, which does not appear when I browse the page local using visual studio. I am using VS 2008 and WCSF. Project and other Dlls are all there. What else is missing? Any ideas to resolve this?


Unable to cast object of type 'System.Web.HttpApplication' to type 'Microsoft.Practices.CompositeWeb.WebClientApplication'.

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.HttpApplication' to type 'Microsoft.Practices.CompositeWeb.WebClientApplication'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidCastException: Unable to cast object of type 'System.Web.HttpApplication' to type 'Microsoft.Practices.CompositeWeb.WebClientApplication'.]
Microsoft.Practices.CompositeWeb.Authorization.WebClientAuthorizationModule.Init(HttpApplication context) +173
System.Web.HttpApplication.InitModulesCommon() +65
System.Web.HttpApplication.InitModules() +43
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +729
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +298
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +289

Version Information: Microsoft .NET Framework Version:2.0.50727.3643; ASP.NET Version:2.0.50727.3634
Apr 11, 2013 at 7:00 PM

I am unaware of why this error is appearing in your application, but maybe you could find the suggestions in the following threads useful:

Also, as described by Michael Puleio in the following blog post, please make sure that your Global.asax file inherits from Microsoft.Practices.CompositeWeb.WebClientApplication:

Damian Cherubini