kum*_*ars 2 c# windows windows-installer wix
c:\ProgramFiles通过 WiX 安装程序,我安装了 Windows 应用程序,并使用 .exe 和所需的 dll创建了文件夹。
运行 .exe 时,我得到了System.UnauthorizedAccessException.
如果有任何有用的建议,请告诉我。
请查找以下事件日志以供参考。
Application: xxxxxxx.exe
Framework Version: v1.0.0
Description: The process was terminated due to an unhandled exception.
Exception Info: System.UnauthorizedAccessException
at System.IO.__Error.WinIOError(Int32, System.String)
at System.IO.FileStream.Init(System.String, System.IO.FileMode, System.IO.FileAccess, Int32, Boolean, System.IO.FileShare, Int32, System.IO.FileOptions, SECURITY_ATTRIBUTES, System.String, Boolean, Boolean, Boolean)
at System.IO.FileStream..ctor(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare, Int32, System.IO.FileOptions, System.String, Boolean, Boolean, Boolean)
at System.IO.StreamWriter.CreateFile(System.String, Boolean, Boolean)
at System.IO.StreamWriter..ctor(System.String, Boolean, System.Text.Encoding, Int32, Boolean)
at System.IO.StreamWriter..ctor(System.String, Boolean)
at System.IO.File.AppendText(System.String)
Run Code Online (Sandbox Code Playgroud)
不要尝试在应用程序不应该写入的地方写入。使用其他文件夹,例如:
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
Run Code Online (Sandbox Code Playgroud)
如果没有可能的替代方案(我对此深表怀疑),请使用管理权限运行可执行文件。
https://msdn.microsoft.com/en-us/library/bb756929.aspx
| 归档时间: |
|
| 查看次数: |
5979 次 |
| 最近记录: |