访问文件时出错 [英] Error while accessing file

查看:64
本文介绍了访问文件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友

最近我用c#做了一个程序。该程序必须打开特定文件,然后从中读取一个字符串。我还需要在登录到Windows之后和Windows的Explorer.exe开始工作之前运行这个程序。所以我改变了注册表,现在我的程序启动时,Windows开始工作。但这是我的问题:当我通常在Windows上运行我的程序时,它可以轻松打开文件并从中读取,但是当这个程序在explorer.exe之前启动时运行时,它无法打开文件。我不知道是什么,但这个问题阻止了我的程序工作。请帮助我。

谢谢

hello friends
recently i make a program with c#. this program must open specific file and then read a string from it. also i need to run this program after Login to windows and before windows's Explorer.exe start working.so i changed the Registry and now my program launch when windows start working. but here is my problem: when i run my program typically on the windows, it can easily open file and read from them,but when this program run on start-up before explorer.exe, it cannot open the file. i don't know what, but this problem prevent my program to work.please help me.
Thanks

推荐答案

可能是您的应用程序运行的用户的访问权限。因为您在资源管理器之前运行,所以(真实)用户尚未登录,并且您的应用程序在服务ID下运行。

看看这个:用C#填充SQL数据库 [ ^ ]部分,它解释了你可能需要做的事情。
Probably, it is access permissions for the user your application is running as. Because you are running before Explorer, the (real) user is not logged in yet, and you app runs under a service ID.
Have a look at this: Backing up an SQL Database in C#[^] under the "So, It'll Work Now?" section, and it explains what you probably need to do.


这篇关于访问文件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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