简体   繁体   English

在我的应用程序中托管ASP.NET

[英]Hosting ASP.NET within my application

I had a wild thought today. 我今天有一个疯狂的想法。 I've been discovering that my users like my web UIs more than my WinForms UIs...but there are good reasons to still write a 'smart client' application. 我发现我的用户喜欢我的Web UI而不是WinForms UI ...但是有充分的理由仍然编写“智能客户端”应用程序。

Can I write my application UI in ASP.NET/MVC, host it inside my client exe, and locally access it using the IE control in my winforms app? 是否可以在ASP.NET/MVC中编写应用程序UI,将其托管在客户端exe中,并使用Winforms应用程序中的IE控件在本地访问它?

Is there a lightweight asp.net server I can host in-process or fork off? 是否有我可以托管进程内或分支的轻量级ASP.NET服务器? Has anyone tried this? 有人尝试过吗? Did the results flatter? 结果好吗?

Yes, short answer: get the source for Cassini and it shows you how to host the web server. 是的,简短的答案:获取Cassini的源代码,它向您展示如何托管Web服务器。

I've used this technique to host web services (*.asmx). 我已经使用这种技术来托管Web服务(* .asmx)。 When the application is online, it can connect to the internet and use a web service there. 当该应用程序在线时,它可以连接到Internet并在其中使用Web服务。 When it's offline, it uses "localhost" to connect to it's local instance of the web service. 脱机时,它使用“ localhost”连接到Web服务的本地实例。 This way you only need to write one data access layer. 这样,您只需要编写一个数据访问层。

I think a wild thought is a understatement ;) I strongly urge you to consider if there isn't something you are missing, if there isn't a better solution but here it goes... 我认为这是一种轻描淡写的想法;)我强烈敦促您考虑是否没有您缺少的东西,如果没有更好的解决方案,但是事情就这样了...

There is such a lightweight server. 有这么轻量级的服务器。 It's also being used by visual studio for developers. Visual Studio也将其用于开发人员。 It was originally called Cassini which uses System.Web.Hosting (a low level API for creating a http server and hosting the asp.net process) 它最初称为Cassini ,它使用System.Web.Hosting(用于创建http服务器和托管asp.net进程的低级API)

尽管聚会晚了,但请检查C#Web服务器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM