Could not find assembly System.ServiceModel
Asked Answered
A

7

5

I'm deploying a webpart on sharepoint and getting some errors. The webpart consumes data from a Web Service and displays a chart using Microsoft Chart (Framework 3.5). When I try to acces it, I get the folowing error:

Could not load file or assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.

StackTrace: at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

I tried copying System.Servicemodel.dll to the bin folder and registering it on the GAC, but the error does not change. Any idea?

Thanks

Adrianaadriane answered 29/1, 2009 at 18:54 Comment(0)
A
0

The problem was within the Web Service, not the webpart. The machine where the web service was deployed has framework 2.0 installed. The exception was catched on the webpart and reported back. Thank you all for your comments.

Adrianaadriane answered 8/2, 2009 at 3:9 Comment(0)
S
4

To expand on the above answers:

It does sound like your site is running on asp.net 2.x. Being that System.ServiceModel is a 3.x component, the assembly will not load. You will need to install 3.5 on the server, or if you already have it set IIS to run the site under 3.5

Sublieutenant answered 30/1, 2009 at 7:7 Comment(0)
S
3

I had a similar problem, but it was because my .NET framework got messed up/corrupted, so I'll post what fixed it for me. Maybe it's overkill, but it worked when nothing else would.

Get the “dotnetfx_cleanup_tool” from http://blogs.msdn.com/b/astebner/archive/2008/08/28/8904493.aspx (I think one of the download links fails, so use the other one)

Uninstall frameworks 2.0 and above (I did 3.5, 3.0, 2.0. 2.0 made me reboot).

IMPORTANT: Go to C:\WINDOWS\Microsoft.NET\Framework and delete or rename the folders for the versions of .NET you removed.

Then I installed .NET Framework 2.0 SP2 (reboot afterwards). The error was gone. I also installed .NET Framework 3.5 SP1 (works without rebooting) and the error was still gone.

Sartain answered 23/5, 2011 at 18:12 Comment(0)
O
0

Try installing .NET Framework 3.5 on your sharepoint server.

Oleaster answered 29/1, 2009 at 20:7 Comment(1)
It's alredy installed. Microsoft Chart requires .net framework 3.5 SP1Adrianaadriane
I
0

It sounds like the Web Part itself was built against an older version of the System.ServiceModel assembly (probably a beta version). If you have access to the web part's source code, you should recompile it against the latest stable version. Otherwise you'll have to find the exact same version of System.ServiceModel and register that into your GAC.

EDIT: You could also try going into your web app's Web.config and replace your System.ServiceModel reference with this:

<Reference Include="System.ServiceModel">
  <SpecificVersion>False</SpecificVersion>
</Reference>
Indiscipline answered 30/1, 2009 at 7:24 Comment(0)
A
0

The problem was within the Web Service, not the webpart. The machine where the web service was deployed has framework 2.0 installed. The exception was catched on the webpart and reported back. Thank you all for your comments.

Adrianaadriane answered 8/2, 2009 at 3:9 Comment(0)
P
0

fire up your Visual Studio 2010 Command Prompt or browse to "C:\Windows\Microsoft.NET\Framework\ v4.0.30319". And run the following command from the command prompt:

aspnet_regiis.exe -iru

Passive answered 8/11, 2011 at 17:23 Comment(0)
R
0

I came across this same problem with a Silverlight 4 app and solved it by switch off Debug Exception checks for

  Common Language Runtime exceptions

in Debug => Exceptions

Hope that helps

Mike

Rimester answered 13/3, 2012 at 8:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.