Hi, I have implemented the code to take a snapshot from the ONVIF camera using ONVIF Device Manger DLL.
private static void Snapshot(string[] parameter, string imgfilename) { string camera_ip = "http://" + parameter[0] + "/onvif/device_service"; Uri Camuri = new Uri(camera_ip);
System.Net.NetworkCredential account = new System.Net.NetworkCredential(parameter[1], parameter[2]); NvtSessionFactory sessionFactory = new NvtSessionFactory(account); INvtSession session = sessionFactory.CreateSession(Camuri); Profile[] Profiles = session.GetProfiles().RunSynchronously(); var snapshotlink = session.GetSnapshotUri(Profiles[0].token).RunSynchronously(); using (WebClient client = new WebClient()) { client.DownloadFile(new Uri(snapshotlink.uri), imgfilename); }
FSharp.Core.dll onvif.discovery.dll onvif.services.dll onvif.session.dll onvif.utils.dll utils.fsharp.dll
The following error occurs when testing ONVIF cameras that have been tested with ONVIF Device Manger.
(417) Expectation Failed FSharp.Core
Server stack trace: System.Runtime.AsyncResult.EndTAsyncResult System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result) System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result) System.ServiceModel.Channels.ServiceChannelProxy.InvokeEndService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]: Microsoft.FSharp.Control.AsyncBuilderImpl.commita OnvifSnapshot.Program.Snapshot(String[] parameter, String imgfilename)
System.ServiceModel.ProtocolException: (417) Expectation Failed ---> System.Net.WebException: (417) Expectation Failed System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
What is the cause of the error? Should I implement the following?
System.Net.ServicePointManager.Expect100Continue = false;
Log in to post a comment.
Hi, I have implemented the code to take a snapshot from the ONVIF camera using ONVIF Device Manger DLL.
private static void Snapshot(string[] parameter, string imgfilename)
{
string camera_ip = "http://" + parameter[0] + "/onvif/device_service";
Uri Camuri = new Uri(camera_ip);
}
DLL reference is below.
FSharp.Core.dll
onvif.discovery.dll
onvif.services.dll
onvif.session.dll
onvif.utils.dll
utils.fsharp.dll
The following error occurs when testing ONVIF cameras that have been tested with ONVIF Device Manger.
(417) Expectation Failed
FSharp.Core
Server stack trace:
System.Runtime.AsyncResult.EndTAsyncResult
System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
System.ServiceModel.Channels.ServiceChannelProxy.InvokeEndService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
Microsoft.FSharp.Control.AsyncBuilderImpl.commita
OnvifSnapshot.Program.Snapshot(String[] parameter, String imgfilename)
System.ServiceModel.ProtocolException: (417) Expectation Failed ---> System.Net.WebException: (417) Expectation Failed
System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
Server stack trace:
System.Runtime.AsyncResult.EndTAsyncResult
System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
System.ServiceModel.Channels.ServiceChannelProxy.InvokeEndService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
Microsoft.FSharp.Control.AsyncBuilderImpl.commita
OnvifSnapshot.Program.Snapshot(String[] parameter, String imgfilename)
What is the cause of the error? Should I implement the following?
System.Net.ServicePointManager.Expect100Continue = false;