I have this method which generates a license by running an exe program on our server:
/// <summary>
/// Generate a new license
/// </summary>
public static void GenerateLicense(string Name, string EmailAddress, Licensing.Types.LicenseType Type, Licensing.Types.ProductTypes Product)
{
string Params = "\"" + Licensing.Types.LicenseTypeToString(Type) + "\" \""
+ Licensing.Types.ProductTypeToString(Product)
+ "\" \"" + Name + "\" \""
+ EmailAddress + "\"";
// Start license executable and pass in all the params
Process.Start(Settings.LicenseExecutableLocation, Params);
}
It’s not throwing any errors, and it’s not apparently running the program (it should be making some files on the server). The location of the executable (Settings.LicenseExecutableLocation) is C:\inetpub\wwwroot\licensegen.exe which is correct, and the paramaters are also correct (I’ve printed them out).
I’m running IIS7, it’s not throwing any errors at all, do I need to change something in IIS7?
Since you’re not getting an exception when launching the process, you need to find out what it is actually doing. I would change your last line to
And then investigate the properties of the pLicenseGenerator object in a debug session after waiting a few seconds for the process to do its thing. This object will be of the Process class and I would pay special attention to the
.ExitCodeproperty. In a well-designed console application, this will be set to a non-zero value if the program encountered an error (like the old DOS %ERRORLEVEL% variable.)If
.ExitCodedoesn’t help, I’d recommend dumping .StandardOutput to the web page or to a file for debugging.When I’ve run into similar issues in the past, it’s always been a problem with the way I formatted the process’s input parameters. Sometimes if a parameter is a long file path, you need to pay special attention to the way you wrap it in double-quotes.
One simple step would be to spit out the exact path and parameters you are passing to
Process.Start()and then see what happens when you run them yourself from the command line. If they work fine, then it is probably some sort of permission-related issue, as another poster speculated.