visual-studio-2010web-servicesssisweb-referencesql-server-data-tools

Why do I get an error when trying to add a web reference in a Script Task (SSIS)?


I'm trying to add a web reference in a SSIS-package on a clients server in order to communicate with a web service.

In my script task I'm able to add the web reference, reference it in the code, build successfully and save it.

BUT when I exit the script task editor I get a script error saying "Script contained in the package have compilation errors. Do you want to save changes?"

If I press Yes here my script task gets an red cross on it and it says "The binary code for the script is not found.".

Even if I create a new poject, add a script task, add the web reference (no other code in the Script Task) with the same result.

However, it works great adding the same reference as a service reference instead, no errors. The problem is that the owner of this webservice said explicitly that I had to use a web reference since it's methods are VS2005 Web Service methods.

I tried the same thing on my local computer and it worked with web references! The only difference I could think of is that I use Microsft Visual Studio 2012 (Data Tools) on my local machine and the server uses Microsoft Visual Studio 2010 (Data Tools).

I also tried to create the SSIS-package on my computer, move it to the server, open it (no errors if i didn't changed anything in the Script Task) and then run the package. Got the following error message "Exception has been thrown by the target of an invocation".

Invocation error ssis

In this case if I opened the Script Task and did any change (even add a comment) I got the same error (The binary code for the script is not found.) after exiting the Script Task.

What I've tried:

Other information:

I've search all over the web for people with a solution to this problem but haven't found any. So I'm turning to SO, how can I solve this problem?

Thanks in advance!


Solution

  • To overcome the disappearing webreference you can try to add the client proxycode manually to your solution:

    1. Open Script component 'Select all files' icon in the solution explorer
    2. Drill down to webreference, and locate reference.cs file
    3. Copy the content of this file to a new class file.
    4. Delete the webreference
    5. Recompile your code, save and exit
    6. Open your project to see whether the reference is saved.