读取服务器上托管的Xml文件 [英] Read Xml file hosted on server

查看:71
本文介绍了读取服务器上托管的Xml文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我正在研究实时网络应用程序。为了提高实时应用程序的性能,我使用了数据库的xml文件。在窗口服务的帮助下生成了xml文件。该服务将不断更新xml文件。当您尝试在多个实例上访问同一站点时,它的工作正常但出现问题。数据未在每个实例上实时反映,意味着在每个实例上反映数据的时间有毫秒/秒。为什么会这样?我使用以下代码来读取xml文件。



DataSet dt_xml = new DataSet();

Hello,

I am working on realtime web application. To improve the performace of realtime application i am using xml file insted of Database.The xml file is generated with the help of window service.This service will keep updating xml file. Its working fine but problem occures when you try to access same site on multiple instance.The data is not reflected in real time on every instance,means there is milliseconds/seconds delay to reflect data on every instance. Why this is happening?? I am using following code to read xml file.

DataSet dt_xml = new DataSet();

using (XmlReader SR = XmlReader.Create(@"D:\Test\Debug_20620\Resources\RTFloatData.xml"))
           {
               dt_xml.ReadXml(SR);

           }
           dt = (from DataRow dr in dt_xml.Tables[0].Rows
                 where dr["p_TagID"].ToString() == TID.ToString()
                 select dr).CopyToDataTable();







我能做什么,以便它能快速工作或数据同时反映在每个实例上..

提前感谢




What can i do,so that it will work fast or data reflect on every instance at a same time..
thanks in advance

推荐答案

而不是使用URL到XML文件,我会创建一个API,在每个请求中返回XML内容。

因此,不是你的服务器定期重新创建XML,它只会在提示时生成。

你可以执行内部缓存控制,以便在每次API调用之间每隔X秒创建一次XML以防止ov erload。



对不起我的英文。我读得比写更好。
Rather than use a URL to an XML file, I would create an API that returns XML content in each request.
So instead of your server recreate the XML periodically, it would only make when prompted.
You could do an internal cache control to create the XML only once every X seconds between each API call to prevent overload.

Sorry for my English. I read better than write.


这篇关于读取服务器上托管的Xml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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