SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


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


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

Author
Message
sej2008
sej2008
SSC Eights!
SSC Eights! (929 reputation)SSC Eights! (929 reputation)SSC Eights! (929 reputation)SSC Eights! (929 reputation)SSC Eights! (929 reputation)SSC Eights! (929 reputation)SSC Eights! (929 reputation)SSC Eights! (929 reputation)

Group: General Forum Members
Points: 929 Visits: 394
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??
Phil Parkin
Phil Parkin
SSC-Forever
SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)

Group: General Forum Members
Points: 49775 Visits: 21151
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.


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
sej2008
sej2008
SSC Eights!
SSC Eights! (929 reputation)SSC Eights! (929 reputation)SSC Eights! (929 reputation)SSC Eights! (929 reputation)SSC Eights! (929 reputation)SSC Eights! (929 reputation)SSC Eights! (929 reputation)SSC Eights! (929 reputation)

Group: General Forum Members
Points: 929 Visits: 394
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.
Phil Parkin
Phil Parkin
SSC-Forever
SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)

Group: General Forum Members
Points: 49775 Visits: 21151
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.


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
AndrewSQLDBA
AndrewSQLDBA
SSCarpal Tunnel
SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)

Group: General Forum Members
Points: 4290 Visits: 3427
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
ccobane1
ccobane1
Grasshopper
Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)

Group: General Forum Members
Points: 17 Visits: 41
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
Andrés Mauricio Repetto...
Andrés Mauricio Repetto Ferrero
SSC Veteran
SSC Veteran (212 reputation)SSC Veteran (212 reputation)SSC Veteran (212 reputation)SSC Veteran (212 reputation)SSC Veteran (212 reputation)SSC Veteran (212 reputation)SSC Veteran (212 reputation)SSC Veteran (212 reputation)

Group: General Forum Members
Points: 212 Visits: 157
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
BI Developer

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search