daelmo wrote:
Please post some additional info:
- RuntimeLibraries version (http://llblgen.com/TinyForum/Messages.aspx?ThreadID=7722).
- Whole Exception message and stack trace (if it's too large, please attach it to your post).
- What are you des/serializing? (EntityCollection, TypedList, etc.)
- Does the error occur always or with some specific object?
Runtime: 2.5.0.0
Exception & Stacktrace
System.InvalidOperationException was unhandled
Message="An error occurred creating the form. See Exception.InnerException for details. The error is: Exception has been thrown by the target of an invocation."
Source="ARTEMIS.WIN"
StackTrace:
at ARTEMIS.WIN.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
at ARTEMIS.WIN.My.MyProject.MyForms.get_frmMain()
at ARTEMIS.WIN.My.MyApplication.OnCreateMainForm() in C:\Projects\ARTEMIS\DevA\ARTEMIS\ARTEMIS.WIN\My Project\Application.Designer.vb:line 35
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at ARTEMIS.WIN.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Note
The Exception occurs when I try to retrieve the OrganisationName from my SysParam table using the following statements:
Dim sysParam As IMainManager = factoryMainManager.CreateMainManagerInstance
OrganisationName = sysParam.GetSysParam.Name
The Exception is in CommonEntityBase.vb at MyBase.New(info, context)
''' <summary>Protected CTor for deserialization</summary>
''' <param name="info"></param>
''' <param name="context"></param>
Protected Sub New(info As SerializationInfo, context As StreamingContext)
MyBase.New(info, context)
' __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
' __LLBLGENPRO_USER_CODE_REGION_END
End Sub
from Web.config
<system.runtime.remoting>
<application>
<service>
<wellknown mode="SingleCall" objectUri="EndPointMain.rem" type="ARTEMIS.RemotingService.MainManagerFactory, ARTEMIS.RemotingService"/>
<wellknown mode="SingleCall" objectUri="EndPointLookup.rem" type="ARTEMIS.RemotingService.LookupTableManagerFactory, ARTEMIS.RemotingService"/>
</service>
<channels>
<channel ref="http" useDefaultCredentials="true">
<serverProviders>
<provider ref="wsdl"/>
<formatter ref="binary" typeFilterLevel="Full"/>
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
<system.web>
from app.config
<system.runtime.remoting>
<application>
<channels>
<channel ref="http" useDefaultCredentials="true">
<clientProviders>
<formatter ref="binary"/>
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
Here is how I get the service references on the Client
If I comment out SerializationHelper.Optimization = SerializationOptimization.Fast then there is no error
Public Sub GetServiceReferences(ByVal ServerName As String)
Dim channel As HttpClientChannel = New HttpClientChannel("HttpBinary", New BinaryClientFormatterSinkProvider())
ChannelServices.RegisterChannel(channel, True)
frmMain.factoryMainManager = DirectCast(Activator.GetObject(GetType(IMainManagerFactory), String.Format(ServerName & "EndPointMain.rem")), IMainManagerFactory)
frmMain.factoryLookupTableManager = DirectCast(Activator.GetObject(GetType(ILookupTableManagerFactory), String.Format(ServerName & "EndPointLookup.rem")), ILookupTableManagerFactory)
'Switch on FastSerialization
SerializationHelper.Optimization = SerializationOptimization.Fast
End Sub
I register the services like this
Namespace RemotingService
Public Class RegisterObjects
Public Shared Sub Main(ByVal args As String())
'Register a channel and assign the service type to it
Dim channel As New HttpChannel()
ChannelServices.RegisterChannel(channel, True)
Dim service1 As Type = Type.GetType("ARTEMIS.RemotingService.MainManagerFactory", True, False)
RemotingConfiguration.RegisterWellKnownServiceType(service1, "EndPointMain.rem", WellKnownObjectMode.SingleCall)
Dim service2 As Type = Type.GetType("ARTEMIS.RemotingService.LookupTableManagerFactory", True, False)
RemotingConfiguration.RegisterWellKnownServiceType(service2, "EndPointLookup.rem", WellKnownObjectMode.SingleCall)
' switch on FastSerialization
SerializationHelper.Optimization = SerializationOptimization.Fast
End Sub
End Class
End Namespace
This all used to work when I hosted the RemotingService in a Console Application and having just written this I've just realised that the Application type of the RemotingService assembly is still set to Console Application
Is this the source of the problem, what should this be set to as its now being hosted in IIS, not a Console Application?
Sorry about the long post.
Thanks