search
HomeDatabaseMysql TutorialUser Access Control 、Program Files 目录 与 Application Data

今天在debug一个奇怪的问题,一个程序在开发机器上没有任何错误,但是安装在客户机器上之后,只要客户运行它,就立刻停止响应。更加奇怪的是,程序本身没有输出任何日志。开始以为是安装包做的不好,但是几次实验之后,证明问题出在程序本身。经过排除法,发

今天在debug一个奇怪的问题,一个程序在开发机器上没有任何错误,但是安装在客户机器上之后,只要客户运行它,就立刻停止响应。更加奇怪的是,程序本身没有输出任何日志。开始以为是安装包做的不好,但是几次实验之后,证明问题出在程序本身。经过排除法,发现这个问题只在启用了UAC的Windows 7和Vista上。于是我包了一个很大的Try Catch,并且用MessageBox直接输出Exception的内容。结果是令人惊讶的,问题居然就出在写Log的地方。

网上搜索了一下,便很快找到了原因。当User Access Control被启用之后,程序不能改写%ProgramFiles%目录中的内容。而我调试的程序一开始就在写Log,同时Log的目录又就是在安装目录底下。说白了,这其实是一个很不好的编程习惯所导致的问题,作为一个正规的程序,它的临时文件应该保存在%APPDATA%中。修改了Log保存路径之后,一切OK。

附C#中获得%APPDATA%的代码:

<span>string</span> appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
access如何设置验证规则access如何设置验证规则Apr 10, 2024 am 10:59 AM

Access 验证规则是一种数据验证工具,用于确保数据符合特定条件,防止输入无效数据。设置验证规则的步骤:1. 选择要设置验证规则的字段;2. 打开“字段属性”对话框并切换到“查找”选项卡;3. 在“验证规则”字段中输入验证规则;4. 在“验证文本”字段中输入不符合规则时的错误消息;5. 单击“确定”保存更改。

microsoft access是什么软件microsoft access是什么软件Mar 03, 2023 am 11:37 AM

microsoft access是由微软发布的关系数据库管理系统;它结合了MicrosoftJet Database Engine和图形用户界面两项特点,是Microsoft Office的系统程序之一。

access和trunk端口的区别是什么access和trunk端口的区别是什么Oct 31, 2023 pm 05:59 PM

access和trunk端口的区别:1、Access端口用于连接终端设备,提供单个VLAN的接入,而Trunk端口用于连接交换机之间,提供多个VLAN的传输;2、Access端口只传输属于指定VLAN的数据,而Trunk端口可以传输多个VLAN的数据,并使用VLAN标签进行区分。

vb中怎么连接access数据库vb中怎么连接access数据库Oct 09, 2023 am 11:38 AM

vb中连接access数据库的步骤包括引用必要的命名空间、创建连接字符串、创建连接对象、打开连接、执行SQL语句和关闭连接。详细介绍:1、引用必要的命名空间,在VB项目中,首先需要引用“System.Data`和`Microsoft.Office.Interop.Access”命名空间,以便使用ADO.NET和Access相关的类和方法,可以在VB项目的引用中添加这些命名等等。

access数据库的扩展名是什么access数据库的扩展名是什么Apr 10, 2024 am 11:10 AM

Access 数据库文件的扩展名为 .accdb,自 Microsoft Access 2007 起开始使用,用于识别包含结构化数据的容器文件,如表、查询和窗体。

access是什么软件access是什么软件Apr 10, 2024 am 10:55 AM

Microsoft Access 是一款关系型数据库管理系统 (RDBMS),用于存储、管理和分析数据。它主要用于数据管理、导入/导出、查询/报表生成、用户界面设计和应用程序开发。Access 优势包括易用性、集成数据库管理、强大灵活、与 Office 集成和可扩展性。

access数据库sql语言中如何把数字1显示为01access数据库sql语言中如何把数字1显示为01Apr 10, 2024 pm 01:17 PM

在 Access SQL 中,使用 FORMAT 函数,并将格式指定为 "00",可以将数字 1 显示为文本格式 "01"。

access数据库是干啥的access数据库是干啥的Apr 10, 2024 pm 01:10 PM

微软 Access 数据库是一种关系型数据库管理系统,主要用途包括:数据存储和管理:储存各种类型的数据并将其组织为表格。数据查询和检索:提供强大的查询工具以查找特定数据。报告和表单设计:创建专业报告和表单以显示和打印数据。应用程序开发:使用 VBA 开发简单应用程序以自动化流程。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),