COM +: ApplicationException invece di eccezione generata
-
04-10-2019 - |
Domanda
Ho una ASP.net webservice che chiama un componente COM +. Una classe nel componente COM + genera un'eccezione che voglio gestire. Ma ApplicationException 'colto dalla webbservice invece della vera eccezione.
Perché?
Edit: dettagli relativi alle eccezioni
System.ApplicationException: Error in the application.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.EnterpriseServices.Thunk.Proxy.CoCreateObject(Type serverType, Boolean bQuerySCInfo, Boolean& bIsAnotherProcess, String& uri)
at System.EnterpriseServices.ServicedComponentProxyAttribute.CreateInstance(Type serverType)
at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj)
at mywebbservice.Batplanering.Behorighet(String sprak) in D:\utv\Bat\Main4\Src\mywebbservice\planering.asmx.vb:line 3542
Soluzione
ApplicationException è gettato al posto del vero un'eccezione se l'eccezione viene generata dall'interno del costruttore della ServicedComponent.
Io award la risposta a tutti coloro che possono dire la mia perché.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow