I am tying to communicate to the IP camera GUUDGO GD-SC01 using ONVIF protocol. In camera's spec stays about ONVIF support: Support - Upgraded Version from 2017-11-28th I am using the code from
How to discover onvif devices in C#
in order to discover device and find listening URI:
var endPoint = new UdpDiscoveryEndpoint(DiscoveryVersion.WSDiscoveryApril2005);
var discoveryClient = new DiscoveryClient(endPoint);
discoveryClient.FindProgressChanged += discoveryClient_FindProgressChanged;
FindCriteria findCriteria = new FindCriteria();
findCriteria.Duration = TimeSpan.MaxValue;
findCriteria.MaxResults = int.MaxValue;
findCriteria.ContractTypeNames.Add(new XmlQualifiedName("NetworkVideoTransmitter", "http://www.onvif.org/ver10/network/wsdl"));
discoveryClient.FindAsync(findCriteria);
After that, I tried to use the code from:
https://www.youtube.com/watch?v=mk6vAyIZZ0A&list=PLc2UaWzFQrPN7XNq2mAkVdsMkRCI0BMML&index=2
together with URI:
http://192.168.0.116:5000/onvif/device_service
deviceUri = new UriBuilder("http://192.168.0.116:5000/onvif/device_service");
deviceUri.UserName = "admin";
deviceUri.Password = "6513Enmujnem";
System.ServiceModel.Channels.Binding binding;
HttpTransportBindingElement httpTransport = new HttpTransportBindingElement();
httpTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Digest;
binding = new CustomBinding(new TextMessageEncodingBindingElement(MessageVersion.Soap12WSAddressing10, Encoding.UTF8), httpTransport);
Device.DeviceClient device = new Device.DeviceClient(binding, new EndpointAddress(deviceUri.ToString()));
Device.Service[] services = device.GetServices(false);
The last line produces: System.ServiceModel.CommunicationException: 'The underlying connection was closed: The connection was closed unexpectedly.'
Can anybody help me with this problem? What could be the cause of this exception?
I also added tracing possibility, but can't see any useful info about this exception:
System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown
[0]:
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
ITAOnvif.Device.Device.GetServices(GetServicesRequest request)
THANKS in advance!