网站和Web应用程序如何通信? [英] How a website and a web application communicate?

查看:73
本文介绍了网站和Web应用程序如何通信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在ASP.Net中开发一个交互式网站,而交互式的意思是它有一个后端应用程序来提供实时逻辑(它不遵循HTTP的请求/响应模型),最终它提供了带有SQL Server数据库的动态* .aspx页.

I want to develop an interactive website in ASP.Net and what I mean by interactive is that it has a back-end application to provide real-time logic (which does not follow HTTP's model of Request/Response) and eventually it is provided with dynamic *.aspx pages with an SQL Server database.

这些组件如何一起使用(作为设计和通信机制)以具有可扩展的应用程序?

And how would the components go together (as a design and as a communication mechanism) to have a scalable application?

编辑:好的,正如你所知道的,我们所有人都趋向于获得比HTTP模型更重要的东西,我希望后端应用程序能够持久地实时工作,例如,它将有一些恒定间隔来对数据库进行一些查询.

Ok, the story is as you know, we all are tending to get something more vital than HTTP model, I want my back-end application to be persistent working in real-time, for example, It would have some constant-intervals to do some queries on the database.

我所想象的设计是一台服务器(拥有一个ASP.Net网站,后端应用程序和数据库),该设计可能会随着时间的推移而变得更加混杂.该网站是用户的交互式界面,该网站需要(有时)进行大量的计算和查询,这些内容可以由后端应用程序更好地处理,然后该应用程序将要包装的信息传递给网站,并格式化为HTML标记以返回.最终用户.

The design as I picture it is a server (holding an ASP.Net website, the back-end application and the database), the design may get more hybrid with time. The website is the interactive interface for the users, the website needs (sometimes) intensive calculations and queries which better be handled by the back-end application, then the application delivers the website the info to be wrapped and formatted as HTML markup to be returned the user eventually.

对设计有何建议?可以与健壮的应用程序共享哪些关键思想,可以迭代开发这些健壮的应用程序,以使将来的更改/增强变得更容易?它可能涉及整个项目的层级,还是在网站和后端应用程序之间是否比常规Web服务更喜欢使用WCF?

Any suggestions about the design? What key ideas you can share to go with a robust application which can be developed iteratively to make future changes/enhancements easier? It could be about the tiers of the whole project or whether to prefer using WCF over regular web services between the website and the back-end application?

推荐答案

有趣.您能否详细说明此应用程序中的逻辑流程?非Web应用程序(我假设它在同一服务器上运行)在做什么?

Interesting. Can you elaborate more on the flow of logic in this application? What is the non-web application (I assume it's running on the same server) doing?

基于到目前为止的描述,我正在描绘一个由SQL数据库和Windows Service驱动的网站,该数据库运行在同一台计算机上(对于实时逻辑应用程序),该服务器对该数据库进行任何处理.但这听起来像是您在寻找比这更直接的互动.

Based on the description so far, I'm picturing a website driven by a SQL database and a Windows Service running on that same machine (for the real-time logic application) doing whatever it needs to do with that database. But it sounds like you're looking for more direct interaction than that.

我希望我的后端应用程序是持续实时工作例如,它将有一些常数间隔进行一些查询在数据库上.

I want my back-end application to be persistent working in real-time, for example, It would have some constant-intervals to do some queries on the database.

(可能应该是)Windows服务或某些其他始终在线的应用程序,它们仅与数据库进行交互.它和网站不需要知道彼此的存在.该网站只是提供通过该过程放置/处理在数据库中的数据.

That could (should, probably) be a Windows service or some otherwise always-on application which simply interacts with the database. It and the website need not know of each other's existence. The website just serves up the data that's placed/manipulated in the database by this process.

网站需求(有时)密集的计算和查询最好由后端应用程序

the website needs (sometimes) intensive calculations and queries which better be handled by the back-end application

这样的异步处理通常对于网站非常有用,因为在浏览器耐心等待的同时,并非所有操作都可以完成.该设计在很大程度上取决于您所执行的操作的直观性,但是首先,我会建议这样的事情:

Asynchronous processing like this is often very useful for a website, since not everything can be done while a browser patiently waits. The design varies heavily on the intuitive nature of what you're doing, but for a start I'd suggest something like this:

  1. 用户在网站上发起"计算".是否设置一些值,上传一批要处理的东西等完全取决于您的工作.要点是用户将其启动.
  2. 该过程执行其不可思议的必要信息将保留在数据库中,并告知用户该过程已排队等待处理.用户现在可以继续做其他事情.
  3. 后端应用程序(或多个应用程序)定期(每分钟,每5分钟等)轮询数据库,或者在上载批处理"文件的情况下,可以使用FileSystemWatcher之类的东西来查找要做和做的新事情.使用多线程或执行此操作所需的任何方法,但要点是,这是网站无需等待的脱机"过程.
  4. 该过程完成后,将在数据库中设置一些标志(在正在处理的记录上,或者在用户的收件箱"中的消息"记录中,或其他内容上),以指示该过程已完成.
  5. 网站用户界面具有一些指示器,该指示器在每次加载时都会检查上述标志,以向用户指示已排队的进程已完成并且可以查看.

后端进程可以在进程完成时另外向用户发送电子邮件等.

The back-end process could additionally send an email to the user at the time a process completes, etc.

这是您所想的要点吗?还是出于某种原因需要进行更直接的互动?

Is that the gist of what you're thinking? Or does the interaction need to be more direct for some reason?

这篇关于网站和Web应用程序如何通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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