Hi all,
after long hours of testing and coding I have no more idea how to solve my current problem.
I want to write a serviced component (System.EnterpriseServices) in <Assembly: ApplicationActivation(ActivationOption.Server)> -mode, that can be used (from a simple VBS-file) with CreateObject. I thought it would be possible this way to replace the missing ActiveX-EXE functionality in .NET...
But it seems only to work for ActivationOption.Library...
Does anyone know how to access a serviced server component from a VBS-file?
Here's some code for better understanding:
Serviced component (Namespace SCTest):
Add following lines to AssemblyInfo.vb from SCTest and set ComVisible to TRUE:
After copying the DLL to GAC (gacutil -i SCTest.dll /f) and registering with COM+ (regsvcs SCTest.dll) create new VBS-File:
So, here's the bug... it always says: "Cannot create ActiveX Component".
If you change
in the AssemblyInfo.vb to
then it works.
after long hours of testing and coding I have no more idea how to solve my current problem.
I want to write a serviced component (System.EnterpriseServices) in <Assembly: ApplicationActivation(ActivationOption.Server)> -mode, that can be used (from a simple VBS-file) with CreateObject. I thought it would be possible this way to replace the missing ActiveX-EXE functionality in .NET...
But it seems only to work for ActivationOption.Library...
Does anyone know how to access a serviced server component from a VBS-file?
Here's some code for better understanding:
Serviced component (Namespace SCTest):
VB.NET:
Imports System.EnterpriseServices
Public Class Class1
Inherits EnterpriseServices.ServicedComponent
Private FText As String = "Not started"
Public Sub New()
End Sub
Public Sub StartMe()
If FText = "Not started" Then FText = "Started: " & Now.ToString
End Sub
Public Sub StopMe()
FText = "Not started"
End Sub
Public Function GetMe() As String
Return FText
End Function
End Class
Add following lines to AssemblyInfo.vb from SCTest and set ComVisible to TRUE:
VB.NET:
Imports System.EnterpriseServices
<Assembly: ApplicationActivation(ActivationOption.Server)>
<Assembly: ApplicationName("SCTest")>
After copying the DLL to GAC (gacutil -i SCTest.dll /f) and registering with COM+ (regsvcs SCTest.dll) create new VBS-File:
VB.NET:
set o =CreateObject("SCTest.Class1")
msgbox o.GetMe()
So, here's the bug... it always says: "Cannot create ActiveX Component".
If you change
VB.NET:
<Assembly: ApplicationActivation(ActivationOption.Server)>
VB.NET:
<Assembly: ApplicationActivation(ActivationOption.Library)>