ssis2008 package containig script task failed to run as a job in sql server

  • I tried to ran a package containing simple script task having messagebox.show(string) in sql server agent as a job using proxy account.It gave me a error stating following message:

    Message

    Executed as user: SRM1\SYSTEM. Microsoft (R) SQL Server Execute Package Utility Version 10.0.2531.0 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved. Started: 1:18:30 PM Error: 2013-05-23 13:18:31.04 Code: 0x00000001 Source: Script Task

    Description: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application. at System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, Boolean showHelp) at System.Windows.Forms.MessageBox.Show(String text) at ST_7999b53452eb43ee8a98fe4494c8ccb0.csproj.ScriptMain.Main() --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture) at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript() End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 1:18:30 PM Finished: 1:18:31 PM Elapsed: 0.579 seconds. The package execution failed. The step failed.

    what is wrong here not understanding can anybody tell me??

  • what is wrong here not understanding can anybody tell me??

    Do not use messagebox in server-side jobs. There is no one there to click OK.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • well I understand but there has to be some solution to it.It is asking me to use overloaded messagebox .show method for using windows handle.

  • sej2008 (5/9/2013)


    well I understand but there has to be some solution to it.It is asking me to use overloaded messagebox .show method for using windows handle.

    There is a solution - remove the messagebox. Apart from (possibly) debugging in VS during development, it has no place in SSIS packages.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • I am receiving the same error in my SSIS Package after deploying it to a Prod Server. I have no messagebox in either script task, they have all been removed. I did have some while in development. The odd thing is that the package runs perfect on my development box, but will not run at all on the Prod Server.

    This is the error message that I have received.

    Executed as user: Mistress\svcsqlsvr. Microsoft (R) SQL Server Execute Package Utility Version 10.50.4000.0 for 64-bit Copyright (C) Microsoft Corporation 2010. All rights reserved. Started: 9:09:05 AM Error: 2013-12-06 09:09:10.28 Code: 0x00000001 Source: Read Directory Name And Text File Name Description: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application. at System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, Boolean showHelp) at System.Windows.Forms.MessageBox.Show(String text) at ST_56d6d2a09f27434183c966b903172458.csproj.ScriptMain.Main() --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript() End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 9:09:05 AM Finished: 9:09:10 AM Elapsed: 5.101 seconds. The package execution failed. The step failed.

    I hope that someone has seen this before, and knows how to fix this issue. I have manually searched thru the XML file that makes up the package, and there is no reference to any MessageBox.

    Thank you in advance for all your assistance

    Andrew SQLDBA

  • Hey Guys, long time lurker; first time poster.

    I ran into this same error message today when trying to run my SSIS pkg via a MSSQL 2008R2 Job and could only finds pieces and bits of a solution online. I utilized a file check Script Task function in my SSIS pkg that was bringing up this error due to it prompting a messagebox. I came up with the below solution:

    Step1: In SSIS, double click on your Script Task to bring up the Script Task Editor.

    Step2: Click on the "Edit Script..." box on the lower right hand corner.

    Step3: Remove the MessageBox.Show commands from the script shown here:

    public void Main()

    {

    // TODO: Add your code here

    String Filepath=Dts.Variables["User::FolderPath"].Value.ToString()+Dts.Variables["User::FileName"].Value.ToString();

    if (

    File.Exists(Filepath))

    {

    Dts.Variables["User::FileExistsFlag"].Value = 1;

    }

    MessageBox.Show(Filepath); //Show the folder path with the File Name

    MessageBox.Show(Dts.Variables["User::FileExistsFlag"].Value.ToString()); //Show the flag value, 1 for exists and 0 for not exists

    Dts.TaskResult = (int)ScriptResults.Success;

    }

    }

    }

    So the final product code looks like so:

    public void Main()

    {

    // TODO: Add your code here

    String Filepath=Dts.Variables["User::FolderPath"].Value.ToString()+Dts.Variables["User::FileName2"].Value.ToString();

    if (

    File.Exists(Filepath))

    {

    Dts.Variables["User::FileExistsFlag"].Value = 1;

    }

    Dts.TaskResult = (int)ScriptResults.Success;

    }

    }

    }

    Removing this allows your SQL job to call the SSIS package and execute it properly, maintaining your logic but removing the messageboxes that cause the aforementioned error.

    Thanks,

    -Caleb

    To improve is to change; to perfect is to change often. – Winston Churchill
  • Did you have a solution for this? I am facing the same problem, the package is not doing any call to a windows form, but when we run it on production the error shows up.. I noticed that our package has a reference to system.windows.form, I am going to remove that and then cross my fingers and hope to that be the final solution.

    Regards,

    A. Mauricio Repetto
    ML Engineer

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply