ASP.net 与 C# 控制台应用程序的基本 Web 前端

发布于 2024-12-01 09:43:22 字数 597 浏览 1 评论 0原文

我有兴趣为我的 C# 控制台应用程序制作一个 Web 前端(它作为服务在专用机器上运行,因此用户永远不会看到控制台),以允许控制各种功能。我对 ASP.net 的经验很少,所以我需要找出最好的方法。

现在我已经将这个漂亮的小型 Web 服务器嵌入其中 (http://webserver.codeplex.com),但我想用 ASP.net 做一个前端会给应用程序带来更多的控制。我对 Google 结果的运气不佳,因为大多数搜索都与 ASP.net 或控制台应用程序有关,但没有将它们一起使用。我基本上不仅需要从应用程序中提取信息并显示它,还需要允许用户输入(主要是文本框和按钮)。

我遇到的另一个问题是,似乎没有任何好的解决方案可以嵌入 ASP.net Web 服务器。我找到了 UltiDev CassiniaspNETServe 但似乎都不能嵌入。两者看起来都需要额外的软件才能运行,这很困难,因为我只想分发 .exe 文件。难道不能完全嵌入ASP.net服务器吗?

I am interested in making a web front end for my C# Console Application (it is ran on dedicated machines as a service so the user never sees the console) allowing for control of various features. I have very little experience with ASP.net so I need to find out what the best approach would be for this.

Right now I have embedded this nice little web server into it (http://webserver.codeplex.com) but I imagine doing a front-end with ASP.net would give a lot more control over the application. I have had very little luck with Google results as most of the searches pertain to ASP.net or Console Applications, but not using them together. I basically need to not only pull information from my application and display it, but allow user input as well (mostly just text boxes and buttons).

The other problem I ran into was it doesn't seem like any good solutions exist for embedding an ASP.net web server. I found UltiDev Cassini and aspNETServe but neither seems like it can be embedded. Both look like they require additional software to be running, which is difficult since I just want to distribute a .exe file. Is it not possible to completely embed a ASP.net server?

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

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

发布评论

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

评论(1

请别遗忘我 2024-12-08 09:43:22

您可能需要查看 IIS 托管 Web 核心< /a> (HWC),它允许您将 IIS 的核心嵌入到您的应用程序中。我相信它可以提供 ASPX 文件。本着充分披露的精神,我没有使用过 HWC,所以我不能说它是否会做你想要的。但自从 Azure 在早期版本中使用(使用?)HWC 作为其 Web 角色以来,我一直对它感兴趣。

但从我读过的内容来看,我认为它可以做到你想要的。缺点是我认为它需要您进行一些本机(C++)编程。不确定这是否有帮助,但我认为这将非常接近您正在寻找的内容。

这是一个 博客文章 描述如何在控制台应用程序中嵌入 HWC。

希望这有帮助!

You may want to look at IIS Hosted Web Core (HWC), which allows you to embed the core of IIS inside your application. I believe it can serve up ASPX files. In the spirit of full disclosure, I have not used HWC, so I can't say whether it will do what you want. But I've been interested in it since Azure uses (used?) HWC for it's web roles in earlier versions.

But from I've read, I think it can do what you want. The drawback is that I think it requires you to do some native (C++) programming. Not sure if that helps or not, but I think this is going to be pretty close to what you're looking for.

Here's a blog article describing how to embed HWC in a Console Application.

Hope this helps!

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