C#VS 2005C#应用程序无法运行
我已经开发了我的开发机上完美运行,当我安装的应用程序。但是,它不能在任何客户端计算机上运行。
我曾与VMWare测试了新安装的Windows,并且仍然是应用程序不运行。
我已添加日志记录以尝试并确定应用程序失败的位置。我以前的版本工作,经过一个星期的发展,我给了客户,然后经历了这个问题。
我在构造函数和Form_Load事件的开始和结束进入记录。构造函数运行正常。但是,在构造函数结束时,它不会在form_load事件中运行,因为我有一个应该打印出来的日志语句。
当应用程序运行时,它会显示几秒钟,在任务管理器,然后加载失败。
我认为这可能是一个很难解决的问题。所以如果有人以前经历过这种情况,或者可以指出我正确的方向来解决这个问题。
表单加载事件中的代码。
private void CATDialer_Load(object sender, EventArgs e)
{
my_logger.Info("Start of form load event"); // Doesn't display this.
.
.
}
=====编辑静态主====
[STAThread]
static void Main()
{
Application.SetCompatibleTextRenderingDefault(false);
// Get the language and set this cultureUI in the statusdisplay that will
// change the language for the whole program.
string language = CATWinSIP.Properties.Settings.Default.Language;
if (language == "th-TH")
{
StatusDisplay.StatusDisplay status_display = new StatusDisplay.StatusDisplay(true);
}
else if(language == "en-GB")
{
StatusDisplay.StatusDisplay status_display = new StatusDisplay.StatusDisplay(false);
}
try
{
Application.Run(new CATDialer());
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
===构造===
public CATDialer()
{
//Set the language for all the controls on the form.
//Has to be done before all components are initialized.
//If not Thai language then must be using English.
if (Settings.Default.Language == "th-TH")
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo("th-TH");
}
else
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-GB");
}
InitializeComponent();
this.statusDisplay1.BalanceStatus = CATWinSIP_MsgStrings.BalanceStatus;
this.statusDisplay1.RedialHistory = CATWinSIP_MsgStrings.RedialHistory;
this.statusDisplay1.LoginStatus = CATWinSIP_MsgStrings.LoginSuccessful;
// Enable logging
XmlConfigurator.Configure();
logger.Info("CATDialer Constructor(): XmlConfigurator.Configure() Loaded [ OK ]");
// MessageBox.Show("Balance Status: " + this.statusDisplay1.BalanceStatus);
//Short cut menu.
this.SetupShortCutMenu();
this.fill_properties();
logger.Debug("CATDialer Constructor(): Fill properties loaded [ OK ]");
}
-
你好,
感谢您的所有建议。
我有问题,我创造了我的类库的一个使用的加密数据流。
我找到了答案时,我已将此添加到我的Program.cs
消息框显示失败的组件的信息。
感谢,
try
{
Application.Run(new CATDialer());
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
你可以发布任何应用程序对象的`static main`和`ctor`吗? – 2009-06-22 05:30:46