本文介绍了新机并部署.NET应用程序越来越"系统无法执行指定的程序"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.NET控制台应用程序,启动Excel中。我有它的工作对我的发展enviornment,但我不能让它在我的生产环境中运行。当我尝试运行它,我收到以下错误系统无法执行指定的程序。我已经安装了.NET 2.0 SP2我的生产服务器上。任何想法?

感谢您,

code

 静态无效的主要(字串[] args)
{

  日期时间priceDate;
  布尔runningForMidDay;
  如果(args.Length == 0)
  {
   priceDate = DateTime.Now;
   runningForMidDay = FALSE;
  }
  其他
  {
     如果(参数[0]的ToString()== - )
     {
        Console.WriteLine(该应用程序......);
        到Console.ReadLine();
        返回;
     }
     如果(!DateTime.TryParse(参数[0]的ToString(),出priceDate))
        priceDate = DateTime.Now;
     如果(!bool.TryParse(参数[1]的ToString(),出runningForMidDay))
        runningForMidDay = FALSE;
  }
  如果(runningForMidDay)
  {...}
  其他
  {...}
}
 

解决方案

他们说,有没有这样的事情作为一个愚蠢的问题,只是愚蠢的人。那么这是这里的情况。我在配置文件中有一个错误。我已经纠正了配置文件和它的作品。

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
  { ... }
}
解决方案

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.

这篇关于新机并部署.NET应用程序越来越"系统无法执行指定的程序"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 03:13
查看更多