0

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

stuartd
  • 70,509
  • 14
  • 132
  • 163
elTech
  • 11
  • 1
  • 5
  • Are you running Visual Studio as 'Administrator'? – stuartd Jul 17 '15 at 09:12
  • Yes, with Administrator also I am seeing the same problem – elTech Jul 17 '15 at 09:22
  • When you run the .exe as Administrator you see the same problem? How about disabling vshosting for the project, does that make any difference when run from Visual Studio? – stuartd Jul 17 '15 at 09:22
  • Yes. When i run the exe as Administrator then also I am seeing the same problem. Tried with disabling vshosting also. Seeing the same issue :( – elTech Jul 17 '15 at 09:44
  • So the error is "Sender not Authorized" - you could run a [Fiddler](http://www.telerik.com/fiddler) trace of the web service call when running in VS and when running standalone and see if there is any difference in the request – stuartd Jul 17 '15 at 09:52
  • Tried Fiddler. What i observe is that, in standalone application soap header is missing. The soap envelope has only body. But i guess in VS, soap header is getting added by VS. In VS Soap header has VsDebuggerCausalityData. Does it mean, as soap header is missing, Server is not able to recognize the sender. And if so then how do we add the soap header ? it has to be added manually in code or is there any VS settings for this ? – elTech Jul 20 '15 at 05:56

0 Answers0