Sunday, February 1, 2009

Loading this assembly would produce a different grant set from other instances

After installing .NET 3.5 sp1, all the MOSS web applications were working fine except for one. The following error was showing up:

Stack trace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
at System.Web.Configuration.Common.ModulesEntry.Create()
at System.Web.Configuration.HttpModulesSection.CreateModules()
at System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers)
at System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) at System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context)
at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)

Fix:
Just restart the application pool account associated with the erroring application and you be all set.

6 comments:

Rahul said...

Thanks a lot. It worked for me and saved me tons of hours in research and debug.

Dan said...

Thanks very much. Worked right away and saved me a lot of headaches. Good work!

Anonymous said...

Thank you. This tip saved my time.

Shola Salako said...

Awesome tip! Greats great. Thanks!

Unknown said...

Thanks alot man! You made the day.

Can you try to provide valid reason behind this exception please?

Sukumarraju
http://weblogs.asp.net/sukumarraju

Ajay Shankar said...

Very good info. Thanks for sharing!

Post a Comment