클라이언트 (WindowsFormsApplication1)가 데스크톱보기를 캡처하여 서버로 보내는 코드에 WCF 서비스를 사용하고 있습니다. 서버가 Masterclient (windowsformsApplication2)로 이미지를 보냅니다. 하지만 객체 참조 내가이 문제를 해결할 수있는 방법은 객체의 인스턴스를 설정하는 아니므로 몇 분 전 ....WCF 클라이언트의 예외
를 클라이언트 측에서 예외를 가지고 이것은 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);
}
}
예외가 발생한 위치에 대한 정보를 추가로 표시 할 수 있습니까? –
나는 이미 주석 줄에서 그 코드를주었습니다 ... 첫 번째 함수 인 SendToServerToMainServer (clsImageObject img) ... – Suryakavitha
serviceobj 객체가 널이됩니다 .. – Suryakavitha