Reputation: 622
I am creating custom process in C# through System.Diagnostics.Process
Assembly. I need to pass arguments to the processes , and am able to to so through the process.StartInfo.Arguments
API. However, when the argument size is large, then I get exceptions . It looks it doesn't allow to move ahead beyond a certain limit of the process arguments. Is there a way/tweak to create a process in a way, so that it can accept arguments of any size (not looking to persist the arguments in DB)?
Upvotes: 0
Views: 696
Reputation: 5109
What arguments are so long? Are you passing data in the arguments?
You could try compressing the data and passing as a base64 string maybe. Assuming that these processes are your own that is.
Otherwise you might want to look into WCF where you would host the processes in IIS or as Windows Services enabling you to call their methods passing any data you need to.
Upvotes: 0
Reputation: 9669
From the Docs
A single string containing the arguments to pass to the target application specified in the FileName property. The default is an empty string (""). On Windows Vista and earlier versions of the Windows operating system, the length of the arguments added to the length of the full path to the process must be less than 2080. On Windows 7 and later versions, the length must be less than 32699.
I don't think there is a way to avoid that limit oob.
On way around this could be to write the args into a temporary file and pass the path to that file instead.
Upvotes: 1