0

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:

  • Server: Windows Server 2012

  • Internet access on server

  • .NET Framework 2.0,3.0,3.5 and 4.5 is installed on the server.

  • Client Tools SDK and Client Tools Backwards Compatiblity is installed on the server.

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!

niklasolsn
  • 303
  • 5
  • 10
  • Can you post the stack trace of the TargetInvocation error ? One thing that you also can try is to save reference.cs when the webreference is added and add it as a class to your scripting component. And see if in that case the class is preserved. – Ako Mar 06 '15 at 08:15
  • I have updated the post with a picture of the error message. I was looking for the reference.cs file but couldn't find it anywhere in the project, even checked the solution folder. Where can I find it? Thanks. – niklasolsn Mar 09 '15 at 08:21
  • 1
    In the project explorer of the scripting component, where you also see ScriptMain.cs there is an icon to show all files. Using that you can drilldown to the file reference.cs – Ako Mar 09 '15 at 08:28
  • 1
    Found it, and I actually got it to work! I added the web reference, copied the reference.cs, removed the web reference and then added reference.cs as a class in my Script Task. Had to uncomment one line in reference.cs and then I could use the reference as before. Ako, make sure to add your comment as an answer and I'll accept it. Thanks! – niklasolsn Mar 16 '15 at 11:53
  • It's ok, I am glad that it works for you. – Ako Mar 16 '15 at 11:55

2 Answers2

3

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.
Ako
  • 1,193
  • 14
  • 22
  • Are there any downsides using this solution? It feels a little bit like a "quick-and-dirty" fix. – niklasolsn Mar 25 '15 at 10:56
  • The downside is that you give up the flexibility that you can not right click and update the webreference when it might change. – Ako Mar 26 '15 at 08:04
0

The quickest and easiest way is to search for the VSTA folder which should pop up under the C:\Users\Your User Directory\AppData\Local\Temp.

Right click on the VSTA folder and go to Properties. Give the account holder full access. Save and close Visual Studio Reopen and it should be fine.