i have using WCF service in my code that the client(WindowsFormsApplication1) capturing desktop view and send it to Server .. After that the Server will send the images to Masterclient(windowsformsApplication2).Its working... but few minutes i got the exception from clientSide as object reference is not to set an instance of an object How can i solve this problem....
and this is mycode:
public void SendToServerToMainServer(clsImageObject img)
{
ConnectToServerSettings();
InterfaceClass.IService serviceobj = Client.CreateChannel();// I got exception in This line,And the serviceobj got null Suddenly...
serviceobj.SendToServerToMasterClient(img, clpro.MyIPAddress);
Client.Close();
Client = null;
}
}
public void ConnectToServerSettings()
{
string StrAddress = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "url1.txt");
//EndpointAddress ea = new EndpointAddress(@"net.tcp://10.0.3.33:2222/ClsPCMain");
EndpointAddress ea = new EndpointAddress(StrAddress);
NetTcpBinding binding = new NetTcpBinding(SecurityMode.None, false);
//binding.TransferMode = TransferMode.Streamed;
binding.MaxBufferPoolSize = Int32.MaxValue;
binding.MaxReceivedMessageSize = Int32.MaxValue;
binding.PortSharingEnabled = true;
binding.ReceiveTimeout = TimeSpan.MaxValue;
binding.SendTimeout = TimeSpan.MaxValue;
binding.OpenTimeout = TimeSpan.MaxValue;
binding.CloseTimeout = TimeSpan.MaxValue;
binding.MaxReceivedMessageSize = Int32.MaxValue;
binding.MaxBufferPoolSize = Int32.MaxValue;
binding.MaxConnections = Int16.MaxValue;
binding.ReaderQuotas.MaxArrayLength = Int32.MaxValue;
binding.ReaderQuotas.MaxBytesPerRead = Int32.MaxValue;
binding.ReaderQuotas.MaxDepth = Int32.MaxValue;
binding.ReaderQuotas.MaxNameTableCharCount = Int32.MaxValue;
binding.ReaderQuotas.MaxStringContentLength = Int32.MaxValue;
binding.Security.Mode = SecurityMode.None;
Client = new ChannelFactory<InterfaceClass.IService>(binding, ea);
}
}