none
Could not load type 'System.ServiceModel.Activation.HttpModule'

    Question

  • Hello everyone,

    I am using VSTS 2010 + C# + .Net 4.0 + IIS 7.5 + Windows 7. When I open an svc file (in IIS manager, right click the svc file and select browse) for a WCF project in IIS, there is an error like this, any ideas what is wrong?

     

    Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

    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.TypeLoadException: Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

    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:

    [TypeLoadException: Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
      System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) +0
      System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName) +95
      System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +54
      System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +65
      System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +69
      System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +52
    
    [ConfigurationErrorsException: Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
      System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +360
      System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, Boolean checkAptcaBit) +27
      System.Web.Configuration.Common.ModulesEntry.SecureGetType(String typeName, String propertyName, ConfigurationElement configElement) +44
      System.Web.Configuration.Common.ModulesEntry..ctor(String name, String typeName, String propertyName, ConfigurationElement configElement) +52
      System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +165
      System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1088
      System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +95
      System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +194
      System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339
      System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +253
    
    [HttpException (0x80004005): Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
      System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8946548
      System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
      System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256
    

     

    regards,

    George

    Friday, September 24, 2010 12:28 PM

Answers

  • I think you need to re-register .NET Framework 4 with IIS. Try the following:

    Open command prompt as an administrator then navigate to your .NET folder (%windir%\Microsoft.NET\Framework\v4.0.30319). Then, issue the following command:

     

    aspnet_regiis -iru
    

     

    Hope this helps.


    If the post is helpful, please don't forget to "vote as helpful" or "propose as answer".

    • Marked as answer by George2 Sunday, September 26, 2010 9:32 AM
    Friday, September 24, 2010 9:32 PM

All replies

  • I think you need to re-register .NET Framework 4 with IIS. Try the following:

    Open command prompt as an administrator then navigate to your .NET folder (%windir%\Microsoft.NET\Framework\v4.0.30319). Then, issue the following command:

     

    aspnet_regiis -iru
    

     

    Hope this helps.


    If the post is helpful, please don't forget to "vote as helpful" or "propose as answer".

    • Marked as answer by George2 Sunday, September 26, 2010 9:32 AM
    Friday, September 24, 2010 9:32 PM
  • Thanks, question answered!
    Sunday, September 26, 2010 9:33 AM
  • Solved my problem too ! ;-)
    NF
    Friday, January 28, 2011 11:40 PM
  • <add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
    Line 195: </httpModules>
    Line 196:



    I am facing this problem, i'm using VS2005
    Saturday, April 23, 2011 11:13 AM
  • Thanks ))
    Vahagn Nahapetyan Blogs : http://vh4u.blogspot.com/ http://3dkinect.blogspot.com/
    Wednesday, November 30, 2011 8:22 AM
  • Thanks indeed! It helped me too. :)
    Tuesday, February 07, 2012 2:18 PM
  • Great

    It worked fine !

    Thanks

    Acmm


    acmm

    Friday, June 08, 2012 12:53 PM