5
votes

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

8

8 Answers

4
votes

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

3
votes

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.

1
votes

Is your website configured to use ASP.NET 2.0.5.something ?

Maybe this article can be helpfull:

Forcing ASP.NET 3.5 ON IIS

0
votes

Try installing .NET Framework 3.5 on your sharepoint server.

0
votes

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>
0
votes

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.

0
votes

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

0
votes

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