将数据写入文件时Web服务出现问题 [英] Problem with web service while writing data into files

查看:86
本文介绍了将数据写入文件时Web服务出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..

长时间后,我在Code Project中发布了一个问题.我非常分散了这个问题.目前,即使我也无法确定问题出在哪里.

请阅读我的整个主题,以清楚地了解我的问题.

项目:我为印度一家著名的银行开发了一个项目,用于收集偏远地区的贷款金额.每个收款代理都有设备(已启用Linux和GPRS)以收集贷款金额.如果GPRS连接可用(数据量很少(200字节)),则每个设备都会立即将付款收据详细信息发送到服务器.如果gprs不存在,它将存储在内部存储器中,当设备进入GPRS区域时,它将发送总数据(非常高).

Web服务:Web服务将从设备接收数据并将其保存到文件(文件名:mechineid [unique] + datetime)中,然后转储到数据库中,并在同一会话中将确认发送回设备
/>
**它适用于少量数据(当GPRS可用时).但是,当设备向大量数据发送数据时,它也可以正常运行.

问题:现场有1200多个设备,这些设备会定期发送大量数据. 某些设备正在以与数据合并到一个文件相同的几分之一秒发送数据.我正在将此文件写入两个不同的文件夹中,即使这些文件正在混合.我无法追踪到底发生了什么.

这是写入文件的代码

Hi..,

After a long time i am posting a Question in Code Project. I very much distributed with this problem. Presently even i am not in a position to where is the problem is occurring.

Please read my entire thread to understand my problem clearly.

Project : I developed a Project for one of the reputed Bank in India for Collecting the loan amounts in remote locations. Every Collection Agent have Device(Linux, GPRS enabled) to collect the loan amounts. Every device will send the payment receipt details to the server immediately if GPRS connection is available(which is very less data(200 bytes)). If gprs is not there it will store in the internal memory, when the device came into GPRS area it will send total data(which is very high).

Web service : Web service will receive the data from Device and saving into the file(filename: mechineid[unique]+datetime) then dumping into the database, sending back Acknowledgment to the device in same session

** it is working fine for the small amount of data(when GPRS is available). But when device is sending to the huge data it''s also receiving fine.

Problem : There are 1200+ devices in the field, which are send the huge data regularly. some device are sending data at same fraction of second that data is merging into one file. i am writing this files in two different folders even those files are mixing. i am not able to trace what is exactly happening.

Here is the code for writing file

public string Execute_DCR(ref Globals.Globals.CliRequest ObjClient, ref  Globals.Globals.RequesInfo HttpReq, string MechineID, string FileBytes)
       {
           string return_str = "^NACK@";

           string BranchCode = Pick_Brach_Code(MechineID);
           string TempFIlename=ConfigurationManager.AppSettings["isbnPath"] + "\\" + BranchCode + "\\upload\\" + MechineID + "_" + DateTime.Now.ToString("ddMMyyyyHHmmss") + ".dat";

           FileStream Fs = new FileStream(TempFIlename, FileMode.CreateNew, FileAccess.Write);
           BinaryWriter Bw = new BinaryWriter(Fs);
           Bw.Write(Encoding.UTF8.GetBytes(FileBytes));
           Bw.Close();
           Fs.Close();
           DumpToSQL(TempFIlename);

           return_str = "^ACK@";
           HttpReq.Respocestring = return_str;
           ObjClient.Command = return_str;
           return return_str;
       }



服务器:Windows Server 2008 R2,IIS 7.5.框架3.5,Sql Server 2005,

有关更多信息,请在问题下添加评论.

请就此回复我,等待您的回复,

在此先谢谢您.



Server : Windows Server 2008 R2, IIS 7.5. Framework 3.5, Sql Server 2005,

for more information drop a comment under the question.

Please get back to me on this, waiting for your reply,

Thanks in advance.

推荐答案

解决方案已找到.

经过长时间的努力,我发现数据在发送方级别混合,我的Web服务很好.

**这个答案是我自己.

谢谢
--RA
Solution Found.

After a long struggle, I observed that the data is mixing at the sender level, my web service is fine.

** This answer is posting myself.

Thanks
--RA


这篇关于将数据写入文件时Web服务出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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