Click here to Skip to main content
15,071,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I made an project in 3 tiers with wcf service which host in windows service

when I try to open the windows form app after I install the service in another computer in the load event there is a code that connect to the wcf service (the window service opened it) and using functions from it-but instead of using it it gave me a error message of a null reference

(when I tried to run the windows form application in the same computer-where the service there-it worked fine)

my code:

my windows form load event:
WCFservice.StudentClient ser = new WCFservice.StudentClient("WcfSvcTcpEndPoint");
//till this line it ran ok and in the next row it fell
List<WCFservice.StudentDTO> sb = new List<WCFservice.StudentDTO>();
foreach (var item in sb)
    string[] s = new string[2];
    s[0] = item.IdS;
    s[1] = item.NameS;
    ListViewItem i = new ListViewItem(s);

my wcf service:
public class Service1 : IStudent
    #region IStudent

    public List<StudentDTO> GetAllStudent()
        StudentBL s = new StudentBL();
        List<StudentDTO> sd = new List<StudentDTO>();
        foreach (var item in s.GetAllStudent())
            sd.Add(new StudentDTO() { IdS = item.idS, NameS = item.nameS });

        return sd;

    public bool AddNewStudent(StudentDTO s)
        StudentBL sb = new StudentBL();
        return sb.CreateNewStudent(s.IdS, s.NameS);


can somebody help me and tell me what the problem?

thanks in advance

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900