简体   繁体   English

在桌面和Web应用程序之间交换数据的最佳实践

[英]Best Practices for Exchanging data between Desktop and Web Application

I have to pass information from a desktop application to Web application and vice versa. 我必须将信息从桌面应用程序传递到Web应用程序,反之亦然。

What are the best practices that are regularly used? 经常使用的最佳做法是什么?

Currrently I'm using Asp.Net and a Winforms. 目前,我正在使用Asp.Net和Winforms。

To pass data to Web Site im creating a (POST) WebRequest and posting an xml to the site. 要将数据传递给网站,请创建一个(POST)WebRequest并将XML发布到该网站。
To pass data to Application im using .Net Remoting from Asp.net 使用Asp.net的.Net Remoting将数据传递到Application im
(I'm using Winforms is an adminstration and monitoring application.) (我正在使用Winforms是一个管理和监视应用程序。)

Edit: Lets treat it as a generic web app and winforms. 编辑:让我们将其视为通用Web应用程序和winforms。

Also currently both Web app and Winforms are on the same machine.(but can change). 目前,Web应用程序和Winforms都在同一台计算机上。(但可以更改)。

Web Services or Windows Communication Foundation (WCF) would be your best bets for remote interoperability. Web Services或Windows Communication Foundation(WCF)将是您实现远程互操作性的最佳选择。

On your website, expose some service end points and consume them from your desktop app. 在您的网站上,公开一些服务端点,并从桌面应用程序中使用它们。 Then send messages as you require. 然后根据需要发送消息。

I'd look hard at the design of the system and consider whether it's necessary to use a Winforms application at all for monitoring and administration. 我将认真研究系统的设计,并考虑是否需要使用Winforms应用程序进行监视和管理。 No, really: creating rich Web sites is quite straightforward (if necessary, with technologies like AJAX) and the architecture of the resulting application will be much, much simpler. 不,真的:创建富网站非常简单(如果需要,可以使用AJAX之类的技术),并且生成的应用程序的体系结构将简单得多。

And, of course, deployment is then really simple. 而且,部署当然非常简单。

I am not sure if there is a best practice for what you are trying to accomplish. 我不确定您要达到的目标是否有最佳实践。 There might be some security concerns you have to think about when allowing posts to your web application however. 但是,在允许将帖子发布到Web应用程序时,您可能要考虑一些安全问题。 It would be very easy for a potential attacker to manipulate the post data and send it to your web application. 对于潜在的攻击者而言,操纵发布数据并将其发送到Web应用程序将非常容易。 You should consider using web services or Windows Communication Foundation. 您应该考虑使用Web服务或Windows Communication Foundation。

注册自定义处理程序,例如Real Player如何注册rstp://或为此Web浏览器注册http://

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

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