问题
I have a .net console app that launches excel. I have it working on my development enviornment, but I can't get it running on my production environment. When I try to run it I receive the following error "The system cannot execute the specified program". I have installed .net 2.0 sp2 on my production server. Any ideas?
Thank you,
Code
static void Main(string[] args)
{
DateTime priceDate;
bool runningForMidDay;
if (args.Length == 0)
{
priceDate = DateTime.Now;
runningForMidDay = false;
}
else
{
if (args[0].ToString() == "-?")
{
Console.WriteLine("This application...");
Console.ReadLine();
return;
}
if (!DateTime.TryParse(args[0].ToString(), out priceDate))
priceDate = DateTime.Now;
if (!bool.TryParse(args[1].ToString(), out runningForMidDay))
runningForMidDay = false;
}
if (runningForMidDay)
{ ... }
else
{ ... }
}
回答1:
They say there is no such thing as a dumb question, just dumb people. Well that is the case here. I had an error in my config file. I have corrected the config file and it works.
回答2:
I've seen this sort of thing happen previously when the C runtime libraries aren't installed on the deployment machine; normally they're not necessary, but they may be required since your app launches Excel.
来源:https://stackoverflow.com/questions/917869/deployed-net-app-on-new-machine-and-getting-the-system-cannot-execute-the-spec