Object reference not set to an instance of an object

Last post 09-23-2007, 7:16 AM by PeteMVG. 7 replies.
Sort Posts: Previous Next
  •  09-19-2007, 9:31 AM 33625

    Object reference not set to an instance of an object

    Hi,

    We have successfully integrated Chat and Messenger into a site on our development server and everything is working fine.

    This morning we moved the site to the live server and suddenly both chat and messenger give the following error:

    "The connection to the chat server is lost. Object reference not set to an instance of an object."

    We are able to get lobby information, user count and create new users etc
    all fine and also log into the admin pages, but joining the chat or logging onto messenger is failing.

    At first I thought it might be a license issue as the domain name has changed but support have just emailed me a temp license to use and that hasn't helped.

    Does anyone have any suggestions on what might be the problem?

    Thanks

  •  09-19-2007, 9:39 AM 33626 in reply to 33625

    Re: Object reference not set to an instance of an object

     
    In the chat window, hold the Ctrl key and double-click the chat window. You will find out a debug window. Copy/paste the error message here.
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  09-19-2007, 12:27 PM 33641 in reply to 33626

    Re: Object reference not set to an instance of an object

    Hello.

    TRACE : Connecting..
    Error : Object reference not set to an instance of an object.

    It just repeats that nine times in the debug window.

  •  09-19-2007, 3:46 PM 33647 in reply to 33641

    Re: Object reference not set to an instance of an object

    Can you check the connection string in your web.config?
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  09-19-2007, 4:07 PM 33651 in reply to 33647

    Re: Object reference not set to an instance of an object

    It seems fine. The messenger/chat database is integrated into the main site db, which is all working fine. Using the chat API we can query lobby information and sign into the cutesoft admin pages to create new rooms. If the connection string was wrong we wouldn't be able to do this?

  •  09-21-2007, 11:44 AM 33723 in reply to 33651

    Re: Object reference not set to an instance of an object

    I fear my client is losing patience. Do you have any suggestions on what else we can check?
  •  09-21-2007, 3:11 PM 33733 in reply to 33651

    Re: Object reference not set to an instance of an object

    PeteMVG:
    It seems fine. The messenger/chat database is integrated into the main site db, which is all working fine. Using the chat API we can query lobby information and sign into the cutesoft admin pages to create new rooms. If the connection string was wrong we wouldn't be able to do this?

     
    PeteMVG,
     
    The above information is not enough for debugging.
     
    Please use the following simple integration code and try again.
     

      //IHttpApplicationConnectionStringProvider

      public string GetConnectionString(CuteSoft.Chat.UserIdentity user)
      {
       return System.Configuration.ConfigurationSettings.AppSettings["CuteChat.SqlClient.ConnectionString"];
       //return System.Configuration.ConfigurationSettings.AppSettings["CuteChat.OracleOleDb.ConnectionString"];
       //return "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\CuteChat3.mdb;";
      }

      //IHttpApplicationUserAdapter

      public CuteSoft.Chat.UserIdentity GetUserIdentity()
      {
       string id=GetUserUniqueName();
       if(id==null)
        return CuteSoft.Chat.UserIdentity.CreateNull();
       CuteSoft.Chat.UserIdentity identity=new CuteSoft.Chat.UserIdentity(id,null,Context.Request.UserHostAddress);
       //identity.CustomItems["myprop"]="myval";
       return identity;
      }

      public string GetUserUniqueName() //Get the ID of current user
      {
    //   if(Session!=null)
    //   {
    //    return (string)Session["userid"];
    //   }

       if(Context.User.Identity.IsAuthenticated)
        return Context.User.Identity.Name;

       return null;
      }

      //IHttpApplicationDataProvider

      public string[] ListUserUniqueName()
      {
       //list the known users
       return new string[]{"admin"};
      }
      
      public bool IsAdministrator(string useruniquename)
      {
       if(string.Compare(useruniquename,"admin",true)==0)
        return true;
       return false;
      }

      public string GetUserDisplayName(string useruniquename)
      {
       switch(useruniquename.ToLower())
       {
        case "admin":
         return "Administrator";
        case "terry":
         return "Terry.X";
        case "marry":
         return "Marry.White";
        default:
         return useruniquename + "test";
       }
      }

      public string[] SearchUserUniqueNameByDisplayName(string userDisplaName)
      {
       switch(userDisplaName.ToLower())
       {
        case "administrator":
         return new string[]{"admin"};
        case "terry.dai":
         return new string[]{"terry"};
        default:
         return new string[]{userDisplaName};
       }
      }
      public bool IsLobbyAdmin(string useruniquename,CuteSoft.Chat.CuteChatLobby lobby)
      {
       return false;
      }

     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  09-23-2007, 7:16 AM 33762 in reply to 33733

    Re: Object reference not set to an instance of an object

    Thanks Adam.
    Before I saw your last post I put a clean install on the server and that worked. So I pointed the clean, working config file to my database and the error started, so I knew it was a db problem. I copied the main cutechat tables and ran the db script over the db to get new tables. By doing this I was able to identify that the CuteChatUser table was the cause of the problem. I have no idea why or how as the database was moved whole from the (working) development server to the live server without any changes. Anyway, I wrote a script to pull the users from our main users table and insert them into the fresh cutechatusers table.

    After that it all worked. Very odd, but I'm not going to worry too much about it.

    Now, any chance of a reply to my other post about inviting users? ;)

View as RSS news feed in XML