tags:

views:

34

answers:

2

I have developped an asmx webservice with visual studio and I deploy on IIS 7 which has 3.5 Framework by copying all the files.

When testing it says

Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

I don't use [System.Web.Script.Services.ScriptService] so I don't understand why it tries to load System.Web.Extensions.

So I change in Visual Studio from .NET 2 to 3.5 but got another error:

Could not load file or assembly 'WebServiceTest' or one of its dependencies. An attempt was made to load a program with an incorrect format.

How to fix this ?

Note: I'm not using any other assembly/lib I'm just learning webservice so it's very simple: I create a webservice Test.asmx with one method which uses one class Test.cs within same namespace WebServiceTest. This works locally.

Finally I have started from scratch again now it works, I think I have mismatched by renaming namespace, class etc.

+1  A: 

Maybe you are using a third party assembly which relies on System.Web.Extensions. Make sure this assembly is not referenced in your project either explicitly or implicitly. Also normally the version of this assembly is 3.5.0.0. From the error message it seems that your project is using version 1.0.61025.0 which is an old version. Try looking at every referenced assembly to see what uses this old version. You might need to deploy it on the target server.

Darin Dimitrov
I'm not using anything I'm just learning webservice so it's very simple: I create a webservice Test.asmx with one method which uses one class Test.cs within same namespace WebServiceTest.
What framework is your application targeting? What references do you have?
Darin Dimitrov
As I have added in main post I targeted .NET 2 and then 3.5 last being the same as server.
Finally I have started from scratch again now it works, I think I have mismatched by renaming namespace, class etc.
+1  A: 

Does the server have web extensions INSTALLED? I think they were an additional install before 4.0. Or: did you also copy the System.Web.Extensions.dll in the correct version? On your computer it may be in the GAC and not in the bin folder.

That said, you should not use that - use WCF to expose web services starting .NET 3.5. you Basically train outdated / retired technology.

TomTom
Thanks Finally I have started from scratch again now it works, I think I have mismatched by renaming namespace, class etc.