如何在 .net 中创建可执行文件

发布于 09-24 18:54 字数 210 浏览 3 评论 0原文

我必须每周向订阅者发送一封电子邮件。这封电子邮件的内容来自数据库。我知道我必须在服务器上设置计划任务(我必须要求这样做,因为我远程工作并且没有管理员权限来执行此操作)。我过去就是这样做的,电子邮件是由计划任务调用的 .net 页面发送的。然而我读到这不是最好的方法,我应该创建一个每次调用时运行的可执行文件。如何在 .net、VisualStudio 2008 中创建可执行文件?你能解释一下吗?非常感谢!

I have to send a weekly email to subscribers. The content of this email comes from a database. I understand I have to set up a scheduled task on the server (I have to ask for this as I work remotely and don't have admin rights to do it). I did this in the past, where the email is sent by a .net page that gets called by the scheduled task. However I've read this is not the best way to do it, and that I should create an executable that runs every time it is called. How do I create an executable in .net, VisualStudio 2008? Could you explain? Many thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

故乡的云2024-10-01 18:54:02

您必须创建一个项目,实现逻辑(根据您的需要对其进行编程)。

您的项目将连接到数据库、检索电子邮件、处理它们、记录所做的事情等...

当您在 project_dir/bin/Debugproject/bin/Release 中编译项目时 (取决于您编译项目的方式)您将拥有库和可执行文件。如果双击可执行文件,它将启动您的应用程序。

您可以将带有依赖库(DLLS)的可执行文件复制到服务器上的某个目录,然后创建计划任务。

You have to create a project, implement the logic (program it to your needs).

Your project will be connecting to database, retrieving emails, processing them, logging what was done, etc...

When you compile your project in project_dir/bin/Debug or project/bin/Release (depending how you compiled your project) you will have your libraries and executable. If you double click the executable it will launch your application.

You can copy your executable with dependent libraries (DLLS) to some directory on the server and then create scheduled task.

彩扇题诗2024-10-01 18:54:02

只需构建一个控制台应用程序 - 它们是可执行的。

(您甚至可以构建一个 WinForms 应用程序,但由于您不需要显示 GUI,这似乎有点毫无意义。)

Just build a console application - they are executable.

(You could even build a WinForms app, but as you don't need to show a GUI this seems a bit pointless.)

枫以2024-10-01 18:54:02

乔恩是对的。构建一个控制台应用程序,然后让任务计划程序根据您需要的频率执行它。

您只需构建它,导航到项目的构建路径并在那里找到您的 .exe 即可。从那里您可以将其复制到您喜欢的任何地方。

Jon's right. Build a console app and then have Task Scheduler execute it as often as you need it to.

You just need to build it, navigate to the build path for the project and find your .exe there. From there you can copy it to where ever ever you please.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文