Web Client Software Factory - Error under Visual Studio 2005 with install of Visual Studio 2008 (orcas) Beta 2
After installing Visual Studio 2008 (Orcas) Beta 2 I received the following error when trying to run a Microsoft Web Client Software Factory (June 2007) based solution from Visual Studio 2005:
I devised a pretty simple workaround for this problem so that I could keep on working.
1. Create a class that inherits from Microsoft.Practices.CompositeWeb.WebClientApplication which overrides Application_PostRequestHandlerExecute and add it to the Web site in the App_Code folder.
using System.Web;
using Microsoft.Practices.CompositeWeb.Interfaces;
using Microsoft.Practices.CompositeWeb.Utility;
public class MyWebClientApplication : Microsoft.Practices.CompositeWeb.WebClientApplication
{
public MyWebClientApplication()
{
}
protected override void Application_PostRequestHandlerExecute(object sender, EventArgs e)
{
HttpContext context = ((HttpApplication)sender).Context;
IHttpContext icontext = new Microsoft.Practices.CompositeWeb.Web.HttpContext(context);
if (icontext.Handler != null)
{
this.InnerPostRequestHandlerExecute(icontext);
}
}
}
We override Application_PostRequestHandlerExecute as it is the only virtual method in the stack trace. In this method we check for a null IHttpContext.Hander before passing it on to InnerPostRequestHandlerExecute. This check prevents the error from occurring.
2. Next we have to tell the web application to run our new version of WebClientApplication instead of the default. Go to Global.asax and change it from:
to
After that your Web Client Software Factory application should again be functional. This method in minimally intrusive so you can easily remove your changes once this issue is addressed in a future version of the factory.
2 Comments so far
Leave a reply
Hi thanks for the solution! I have not tried this yet because I tried uninstalling Orcas Beta 2 and still have the problem. I’m trying to just get back to 2005 stable with WCSFExtensions - everything looks right but I still get the error. Does anyone know how to repair the DLLs that cause this problem? I’m not sure which DLL gets corrupted by 2008 install and wasted a day or two now trying to repair the Entprise Library and others to no avail. Thanks for the ideas..
Hey brad, just started playing around with WCSF today and came across this little bug.. pity you werent on msn for me to bug you about it, was an interesting one tho