Negar
Negar

Reputation: 906

System.ServiceModel.Activation.HttpModule error

what is the cause of this error on below line?

<system.web>
    <globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="fa-IR" uiCulture="fa-IR" />
    <compilation targetFramework="4.0" debug="true">
      <assemblies> <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral,  PublicKeyToken=b77a5c561934e089" />

Upvotes: 7

Views: 34788

Answers (7)

Pecan
Pecan

Reputation: 350

appcmd.exe set config -section:system.webServer/modules /[name='ServiceModel'].preCondition:"managedHandler,runtimeVersionv2.0" /commit:apphost

worked for me

Upvotes: 0

RuudvK
RuudvK

Reputation: 635

I had this problem on a server managed by one of our clients. I didn't have the access to run the aspnet_regiis.exe tool. As a workaround I did the following:

  1. I removed aspNetCompatibilityEnabled="true" from the <serviceHostingEnvironment> tag in the web.config
  2. removed [AspNetCompatibilityRequirements] from the webservice.cs file

Unfortunately this means that for example HttpContext.Current becomes null, I could fix my webservice by rewriting all my HttpContext.Current.Server.MapPath calls to System.Web.Hosting.HostingEnvironment.MapPath

Hope this helps someone.

Upvotes: 2

Innovation Wang
Innovation Wang

Reputation: 199

For Windows 8 you need to Windows features and enable everything under .Net Framework 3.5 and .Net Framework 4.5 Advanced Services -> Enable Everything

Upvotes: 8

Ervin Czimskey
Ervin Czimskey

Reputation: 101

This problem surfaced for us immediately after we installed the Windows Management Framework 3.0/PowerShell 3.0 sp1 (KB2506143) on a Windows Server 2008 R2 x64. Windows Update then also installed KB2736422, KB2756921, and KB2656411 immediately after.

Our solution was to first uninstall KB2506143 (and the three updates that accompanied that), then run aspnet_regiis.exe -iru as suggested in Ed209's response above. Both steps were necessary to resolve the problem. Thank you, Ed209.

Upvotes: 0

user2306751
user2306751

Reputation: 21

For windows 8 the above configuration in Control panel->programs->windows features on/off enable every thing under".net Framework3.5" and ".net Framework 4.5 advanced Services" Working fine for me.

Thanks Madhavi.B

Upvotes: 2

Neha
Neha

Reputation: 331

Everywhere the problem to this solution was mentioned as re-registering aspNet by using aspnet_regiis.exe. But this did not work for me.

Though this is a valid solution (as explained beautifully here)

but it did not work with Windows 8.

For Windows 8 you need to Windows features and enable everything under ".Net Framework 3.5" and ".Net Framework 4.5 Advanced Services".

Thanks Neha

Upvotes: 33

Ed Boiling
Ed Boiling

Reputation: 336

This happens when you install .Net 4 before enabling IIS, or if you register WCF after registering .Net 4. In either case, your App Pools will be running .Net 2.0 (which is the CLR version required for .Net 3 if you have registered WCF, which installs ASP.Net 3.5, or the default if you have installed IIS after .Net 4)).

There are many references to this on the web, e.g. the MSDN blogs: http://blogs.msdn.com/b/webtopics/archive/2010/04/28/system-typeloadexception-for-system-servicemodel-activation-httpmodule-in-asp-net-4.aspx

The fix is to re-register ASP.Net 4 from the correct (32 or 64 bit) Framework folder (Framework64 on a 64bit server), using the aspnet_regiis.exe tool, e.g.

aspnet_regiis.exe -iru

Upvotes: 22

Related Questions