简体   繁体   English

多客户端连接时C#服务器程序挂起

[英]C# server program hangs when multi clients connects

Greetings! 问候!

I have ac# console application which is installed as windows service in live machine. 我有一个ac#控制台应用程序,它已作为Windows服务安装在实时计算机中。 This application acts as server and uses http and https services. 此应用程序充当服务器,并使用http和https服务。 To commuunicate with client URLS's Tiny HTTP server open source is used. 为了与客户端URLS的Tiny HTTP Server通信,使用开源。 There are 90 clients using accessing the data from server using a client program which is developed using flex. 有90个客户端正在使用通过使用flex开发的客户端程序从服务器访问数据。 This flex application connect to server as below, 此flex应用程序按以下方式连接到服务器,

Login url 登录网址

try
{
   if(!Request.Uri.AbsoluteUri.Contains("https"))
        System.Threading.Monitor.Enter(Lock);
   if (Request.Method == Method.Post)
   {
      SiteSession siteSession = _login( Request.Form["SiteName"].Value.Trim(),
                                        Request.Form["UserName"].Value.Trim(),
                                        Request.Form["Password"].Value.Trim());
      if (siteSession != null)
      {
           if (siteSession.authenticated)
           {
              User currentUser = siteSession.thingzDatabase.currentUser;
              _database = siteSession.thingzDatabase;

                             --------

item/detail urls like http:\\domainname:port\\item\\detail\\temid one client calls nearly 70 url's and get data from server database.So totaly 90+ clients 诸如http:\\ domainname:port \\ item \\ detail \\ temid之类的item / detail url,一个客户端调用了将近70个url并从服务器数据库获取数据。因此总共有90多个客户端

when item/list is called below code is performed. 当在下面的代码中调用项目/列表时。

if (Id == "")
{
   //System.Threading.Monitor.Enter(_locker);
   System.Threading.Monitor.Enter(Lock);
   try
   {
     if (Request.AcceptTypes == null)
     {

        TypeController.session_id = Request.QueryString["sessionid"].Value;

        //queue.   
        Enqueue(Request.QueryString["sessionid"].Value);

        //string que = "";

        ////do
        ////{
        //que = queue.Dequeue();
        //TypeController.session_id = que;

        langStr = SessionDatabase.Language;
        filter = new AllThingzFilter(SessionDatabase, parameters, langStr);

        TypeController.session_id = null;

        filter.Execute();
                                 --------

There is one administrator who updates/ writes the data to the server database using secure https service with different port number. 一位管理员使用不同端口号的安全https服务将数据更新/写入服务器数据库。 same login url calls and other post and get methods will be called in admin login. 相同的登录url调用和其他post和get方法将在管理员登录中调用。

Database used in server is sqlite. 服务器中使用的数据库为sqlite。 Now let me explain my problem, I have received complaint from client saying server gets hanged and administrator cannot be able to login . 现在,让我解释一下我的问题,我收到客户的投诉,说服务器挂起,管理员无法登录。 Or if login not able to upload any images as soon any update to database is performed the server hangs. 或者,如果登录无法在执行对数据库的任何更新后立即上传任何图像,则服务器将挂起。 So need to restart the windows service again. 因此需要再次重新启动Windows服务。

When admin perform the CRUD operations to the server db. 管理员执行对服务器数据库的CRUD操作时。 At the same time client application( flex) application try to get the data from server as well.This url calls from client applicatuon every 5 mins once. 同时,客户端应用程序(flex)应用程序也尝试从服务器获取数据。此url每隔5分钟从客户端应用程序一次调用一次。

What could be the issue and how can i solve this server hand. 可能是什么问题,我该如何解决此服务器问题。 Is it a read or write issue to sqlite db. 是对sqlite db的读取或写入问题。 Please help me with valuable suggessions. 请帮我提出宝贵的建议。

Regards Sangeetha 关于Sangeetha

解决方案是将ASP.NET Web角色/成员功能与该DB CRUD操作分开:后者应实现自己的自治安全模型,或使用角色/成员类的输入。

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

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