【问题标题】:Exe setup creating error when running from desktop short cut and without Administrator right从桌面快捷方式运行且没有管理员权限时,Exe 安装程序创建错误
【发布时间】:2014-10-01 11:18:00
【问题描述】:

问题:

这里的问题是,当我以管理权限运行我的项目的 .exe filefrom C:\Program Files (x86)\Atoz\My Product Name 时,它工作正常,没有错误。但是当我在没有管理权限或管理员权限的情况下从desktop or start menu 运行我的项目的.exe file 时,我收到如下错误。

错误:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at Authentication.IsValidUser(String Login_Id, String Pwd) in c:\Users\Administrator\Desktop\CarServiceNew\CarServiceNew\Authentication.cs:line 29
   at CarServiceNew.Login.btnLogin_Click(Object sender, EventArgs e) in c:\Users\Administrator\Desktop\CarServiceNew\CarServiceNew\Login.cs:line 25
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.PerformClick()
   at System.Windows.Forms.Form.ProcessDialogKey(Keys keyData)
   at System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)
   at System.Windows.Forms.TextBoxBase.ProcessDialogKey(Keys keyData)
   at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
   at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
   at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)

我对此一无所知。因此,如果有人对此问题有任何建议或解决方案,那将是可以预期的。提前致谢。

注意

Here i have tried to give support for framework 4 on windows 7 os 这个项目是在框架 4.5 中制作的

【问题讨论】:

  • 那么堆栈跟踪中指示行周围的代码是什么?
  • 我用我的项目跟踪它,但当时我没有收到任何错误。

标签: c# .net installation exe


【解决方案1】:

我猜你还没有设置执行级别。打开您的 app.manifest 并进行编辑。

重要的片段应该是这样的:

  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <requestedExecutionLevel level="requireAdministrator" />
        // and so on... //

如果 UAC 已打开,它应该会在应用启动时告诉您此工具需要 admin-privilegs。

编辑:
哦...我想我误解了你的问题。即使以管理员身份启动,您也会从桌面收到错误???

【讨论】:

    猜你喜欢
    • 2017-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多