Deployed .net app on new machine and getting “The system cannot execute the specified program”

旧城冷巷雨未停 提交于 2019-12-12 15:18:21

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!