C#app已安装但未运行 [英] C# app Installed but does not run

查看:69
本文介绍了C#app已安装但未运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个安装文件并将其安装在我的计算机上

它运行良好。

但在其他计算机上安装但不安装运行。

(当我在其他计算机上运行时,我看到COM代理在任务管理器中打开,我也可以看到我的应用程序。在2秒COM代理退出后。)

两台计算机是64位,我的应用程序也是64位。

i创建简单项目并为其创建安装文件并将其安装在每台计算机上。它运行在每台计算机上没有任何问题。

我的应用程序需要两个先决条件.1。.net framwork 4.5和2)sql server 2012

因为我说它安装完美只是没有运行。

I create an setup file and installed it on my computer
it works great.
but on other computer it installs but does not run.
(when i run it on other computer , i see "COM surrogate" open in task manager and i can see my app too. after 2 second "COM surrogate" quit.)
two computers are 64 bit and my app is 64 bit too.
i create simple project and create a setup file for it and installed it on each computer . it runs in each computer without any problem.
my app need two prerequisite.1).net framwork 4.5 and 2)sql server 2012
as i said it install perfectlly just does not run.

推荐答案

我猜计算机之间的一个区别是你的计算机是安装了Visual Studio的开发PC。这有时可能是一个问题。



另一个区别可能是你的电脑上以管理员身份运行,而另一台电脑上的权限更受限制。



如果您没有收到任何运行时错误,请确保您的代码中没有忽略错误,例如空catch子句。这样的代码很常见。



您还可以在代码中添加日志文件功能并保存到磁盘,例如

I guess one difference between the computers is that your computer is a development PC with Visual Studio installed. This can be a problem sometimes.

Another difference could be that on your PC you run as admin and on the other PC the privileges are more restricted.

If you don't get any run time errors, make sure you don't have ignored errors in your code, such as empty catch clauses. It is very common by rookies to code like that.

You can also add a log file functionality in your code and save to disk, like
I am here now.
Init method A.
Exit method A.



或类似。

同时保存任何错误消息,如


or similar.
Also save any error messages like

catch (Exception ex)
{
   streamWriter.WriteLine(ex.ToString());
   streamWriter.Flush();
}



现在可以更轻松地追踪执行并找到问题。



Don在每个写入的行之后忘记刷新writer对象。

如果你的程序在没有关闭文件的情况下崩溃并且你没有正确刷新,那么文件将是空的。


Now it will be easier trace the execution and find the problem.

Don't forget to flush the writer object after each written line.
If your program crashes without closing the file and you didn't flush properly, the file will be empty.


这篇关于C#app已安装但未运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆