19143

Could not load file or assembly 'System.ServiceModel.Web, Version=4.0.0.0'

Could not load file or assembly 'System.ServiceModel.Web, Version=4.0.0.0' or one of its dependencies. The system cannot find the file specified.

I am new with visual studio 2013 and I am trying to make wcf data service with .edmx but I could not made my wcf data service due to above error.

<strong>Myservice.svc File in visual studio 2013</strong>

<%@ ServiceHost Language="C#" Factory="System.ServiceModel.Activation.WebServiceHostFactory, System.ServiceModel.Web, Version=4.0.0.0" Service="_4669.MyService" %>

<strong>Myservice.svc File in visual studio 2010</strong>

This one is working fine.

<%@ ServiceHost Language="C#" Factory="System.Data.Services.DataServiceHostFactory, System.Data.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Service="LoanCalculatorService.srvcLoanCalculator" %>

<strong>web.config</strong>

<?xml version="1.0" encoding="utf-8"?> <!-- For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433 --> <configuration> <configSections> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </configSections> <system.web> <compilation debug="true" targetFramework="4.5"> <assemblies> <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> <add assembly="System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /> <add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> </assemblies> <buildProviders> <add extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider" /> </buildProviders> </compilation> <httpRuntime targetFramework="4.5" /> </system.web> <system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> </system.serviceModel> <connectionStrings> <add name="SupportDBEntities" connectionString="metadata=res://*/App_Code.Model.csdl|res://*/App_Code.Model.ssdl|res://*/App_Code.Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=GOVINDA;initial catalog=SupportTicket;persist security info=True;user id=sa;password=sa_12345;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /> </connectionStrings> <entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> <parameters> <parameter value="v11.0" /> </parameters> </defaultConnectionFactory> </entityFramework> </configuration>

Note:-

In my case when I make wcf data service in visual studio 2010 then it working and when i make in visual studio 2013 then it is not working in my case.

if someone have any idea about it then please help me.

Thanks in advance !..

Answer1:

I found that none of the above solutions worked for me on a newly built Windows 2012R2 server. I had 3.5 and 4.5 installed as both Frameworks and ASP.NET Features. Recompiling my application as Full rather than Client made no difference. Then I tried browsing to the Default Web Site and when that gave the same error I started to think something fundamental was wrong.

The solution I found was to edit the web.config in both C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config and C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config

(assuming that you may use either 32 or 64 bit application pools)

and simply comment out the reference to System.ServiceModel.Web ie:

Change

<add assembly="System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

to

<!--add assembly="System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/-->

The Default Web Site then loaded correctly and so did my own ASP.NET system

Answer2:

Try adding this to your assembly list:

<add assembly="System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

Also if you don't have .NET 4.0, get it here: http://www.microsoft.com/en-US/download/details.aspx?id=17718

Answer3:

I encountered such a situation in following circumstances: Windows Server 2012 R2 hosts in IIS 2 web applications: one compiles against .NET 3.5 another - to .NET 4.5.1. Both are running in Intergrated pipeline Server have installed .NET 3.5/4.0/4.5/4.5.1 with latest updates. Issue was encountered in application on .NET 3.5. Fix was to update web.config transform with

<system.webServer> <handlers> <remove name="svc-Integrated-4.0" xdt:Transform="Insert" /> </handlers> </system.webServer>

As far as I understand, System.ServiceModel.Web, Version=4.0.0.0 could not be loaded in application pool running against ASP.NET 2.0 (for apps, compiled against .NET 3.5), while svc-Integrated-4.0 handler tries to load it.

Recommend

  • Running Gulp-Angular-Protractor without gulp.src
  • Generate REST API documentation
  • grunt-karma not running the spec file when using shared config
  • ServiceStack Razor web.config
  • Instaling Orchard at the root stops other ASP.net applications at different folders
  • Main class not found when using Manifest jar with JavaExec in Gradle
  • Apache mod_rewrite rule as subdomain
  • java.util.Properties$LineReader.readLine
  • MVC Kendo - 'System.Web.Mvc.HtmlHelper' could be found
  • Snakemake: How to save and access sample details in config.yml file?
  • Rectifying JScript runtime error
  • Referencing to the EntityFramework.dll cause an run-time error in VS2010
  • WCF Rest Service Not returning data in browser
  • Adding default role to newly registered user in VS Express 2013
  • Axis2 + Tomcat: Web service working directory
  • Exception: System.ArgumentException: Keyword not supported: 'initial catalog' when hard co
  • Could not load file or assembly 'System.ServiceModel.Web, Version=4.0.0.0'
  • How can I use the system.net section of my app.config in a partial trust environment?
  • reading content of an config file into the dll associated with it
  • Azure Bot Framework Emulator Error - System.ArgumentNullException: Value cannot be null
  • ADO.NET provider with invariant name 'System.Data.SqlClient;' cannot be found (Entity Fram
  • Unable to scan Code 128
  • Default CUDA addition rounding mode between cuda 5.0 and 7.5
  • Easy Way to Get Averages Based on Names in List
  • use rvest and css selector to extract table from scraped search results
  • Which browser have this strange user agent? (IOS device)
  • ConfigurationBuilder not working in azure function
  • What does certain JVM do after loading ByteCode into memory?
  • Varnish/Apache Random 503 Errors
  • What is the undocumented SessionIdInterface in PHP 5.5?
  • Cuda Clang and OS X Mavericks
  • aapt.exe'' finished with non-zero exit value 1
  • Android app gives error “BatteryStatsImpl: reading network stats”
  • How to run “Deployd” on port 80 instead of port 5000 in webserver.
  • SignalR .NET Client Invoke throws an exception