I have created a C# winform application to display video from CCTV camera. I have added the ONVIF WSDL for Device, Media and PTZ as service reference to my application.
My application runs perfectly fine on VS2010 in both Debug and Release mode. But when I click on myapplication.exe file inside either Debug or Release folder, it crashes. Please note that, I have all the dependency files or dlls in that folder.
On debugging using log4net, I found that when we launch as a standalone application, "Proxy_device.GetSystemDateAndTime()" call fails. And Proxy_device is not NULL also. I tried to catch the exception and printed the message. it says "Sender not Authorized".
Here are the stack traces
2015-07-17 13:18:20,224 [1] ERROR Onvif_Client.Connection - Sender not Authorized.
2015-07-17 13:18:20,225 [1] ERROR Onvif_Client.Connection - System.ServiceModel.FaultException: Sender not Authorized.
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Onvif_Client.ServiceReference1.Device.GetSystemDateAndTime()
at Onvif_Client.Connection.CreateChannels() in .....
2015-07-17 13:18:20,296 [1] ERROR Onvif_Client.Connection -
2015-07-17 13:18:20,297 [1] ERROR Onvif_Client.Connection - mscorlib
2015-07-17 13:18:20,298 [1] ERROR Onvif_Client.Connection -
Also I tried to debug by Attaching the process to VS2010 and with this also application runs perfectly fine.
So looks like some dependency file which is present in VS but as a standalone application its missing. But I am not able to figure out what is that dependency. As call fails in GetSystemDateTime(), I doubt ONVIF DEVICE WSDL is missing or may be some other reason.
It would be great help if i get some direction to proceed with this problem.
Thanks