HighTechTalks DotNet Forums  

Is there Sample Code for creating a Object for use with IIS and ASP (Not ASp.Net)?

Dotnet Framework (Component Services) microsoft.public.dotnet.framework.component_services


Discuss Is there Sample Code for creating a Object for use with IIS and ASP (Not ASp.Net)? in the Dotnet Framework (Component Services) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Scott Townsend
 
Posts: n/a

Default Is there Sample Code for creating a Object for use with IIS and ASP (Not ASp.Net)? - 07-22-2003 , 05:22 PM






I'm trying to write a COM Object in VB .NET and not having the best of luck.



I'm not 100% sure that I have the Code writen properly to expose the methods
in my object or if I'm just not registering the dll properly on the Target
machine.



I've included the Code for the Object below. Does it Look fine?



I then register it on the Target machine with the following:

regasm comMyCom.dll /tlb:comMyCom.tlb /codebase
gacutil /i comMyCom.dll
installutil comMyCom.dll

regsvcs comMyCom.dll

I've tried the above separately in different order nothing seems to work.
When I look at the Object in the Component Services Snapin. I do not see the
send method for the _comMyCom Interface. I see it for the IcomMyCom
interface.



What Gives?



Any tips would be appreciated!



Scott<-



----------------------------------------------------------------------------

AssemblyInfo.vb

----------------------------------------------------------------------------

Imports System

Imports System.Reflection

Imports System.Runtime.InteropServices

Imports System.EnterpriseServices

Imports System.EnterpriseServices.ActivationOption

Imports System.EnterpriseServices.AccessChecksLevelOption



' General Information about an assembly is controlled through the following

' set of attributes. Change these attribute values to modify the information

' associated with an assembly.

' Review the values of the assembly attributes

<Assembly: AssemblyTitle("ComMyCom")>

<Assembly: AssemblyDescription("")>

<Assembly: AssemblyCompany("E&M Electric, Inc.")>

<Assembly: AssemblyProduct("")>

<Assembly: AssemblyCopyright("2003")>

<Assembly: AssemblyTrademark("")>

<Assembly: CLSCompliant(True)>

'The following GUID is for the ID of the typelib if this project is exposed
to COM

<Assembly: Guid("8A4F863A-1CD4-4E8E-942C-912EF1B1D975")>

'<Assembly: ApplicationAccessControl(True)>

<Assembly: ApplicationAccessControl(True)>

#Region "COM+ Registration details "

'Supply the COM+ application name

<Assembly: ApplicationNameAttribute("ComMyCom")>

<Assembly: ApplicationActivation(ActivationOption.Server)>

'Supply a strong-name assembly

<Assembly: AssemblyKeyFileAttribute("..\\..\\comMyCom.snk")>

#End Region





' Version information for an assembly consists of the following four values:

'

' Major Version

' Minor Version

' Build Number

' Revision

'

' You can specify all the values or you can default the Build and Revision
Numbers

' by using the '*' as shown below:

<Assembly: AssemblyVersion("1.0.*")>





----------------------------------------------------------------------------

comMyCom.vb

----------------------------------------------------------------------------

Option Explicit On

Option Strict On

Imports System

Imports System.web.mail

Imports System.EnterpriseServices

Imports System.EnterpriseServices.ActivationOption

Imports System.EnterpriseServices.EventTrackingEnabledAttr ibute

Imports System.Reflection

Imports System.Runtime.InteropServices

Imports System.Runtime.InteropServices.ClassInterfaceType



Public Interface IcomMyCom

Function Send(ByVal strEmailAddress As String, ByVal strEmailServer As
String) As Boolean

End Interface



' I've tied the three Attributes with all the same results....

'<ComClass(comMyCom.ClassId, comMyCom.InterfaceId, comMyCom.EventsId)> _

'Public Class comMyCom

'<ClassInterfaceAttribute(ClassInterfaceType.AutoD ual)> _

'Public Class comMyCom

<TransactionAttribute(TransactionOption.Required)> _

Public Class comMyCom

Inherits EnterpriseServices.ServicedComponent

Implements IcomMyCom

'Inherits ServicedComponent

' Use the Region directive to define a section named COM Guids.

#Region "COM GUIDs"

' These GUIDs provide the COM identity for this class

' and its COM interfaces. You can generate

' these guids using guidgen.exe

Public Const ClassId As String = "6983A5C3-6E8A-46d9-90B3-4426BE69588C"

Public Const InterfaceId As String = "5203E497-075F-4f6f-9A25-B697A0C38A6D"

Public Const EventsId As String = "F871F568-5407-4f34-BF00-1A2BDAEC03F1"

#End Region



Public Sub New()

MyBase.New()

End Sub



Public Function Send(ByVal strEmailAddress As String, ByVal strEmailServer
As String) As Boolean Implements IcomMyCom.Send

Send = True

End Function

End Class





Reply With Quote
  #2  
Old   
Kumar Gaurav Khanna [.NET MVP]
 
Posts: n/a

Default Re: Is there Sample Code for creating a Object for use with IIS and ASP (Not ASp.Net)? - 07-26-2003 , 09:29 PM






Hi!

Once you create the component, install it into a COM+ application using the
COM+ MMC in Administrative Tools. Next, export the proxy for the application
and install it in the relevant client systems. Add a reference to this proxy
(Add Reference->COM components) in your .NET application.

Regards,
Gaurav Khanna

--
----------------------------------------------------------------------------
----------
Microsoft MVP - .NET, MCSE Windows 2000/NT4, MCP+I
WinToolZone - Spelunking Microsoft Technologies
http://www.wintoolzone.com/
OpSupport - Spelunking Rotor
http://opsupport.sscli.net/
----------------------------------------------------------------------------
----------

"Scott Townsend" <scott@-NO-SPAM.serra.com> wrote

Quote:
I'm trying to write a COM Object in VB .NET and not having the best of
luck.



I'm not 100% sure that I have the Code writen properly to expose the
methods
in my object or if I'm just not registering the dll properly on the Target
machine.



I've included the Code for the Object below. Does it Look fine?



I then register it on the Target machine with the following:

regasm comMyCom.dll /tlb:comMyCom.tlb /codebase
gacutil /i comMyCom.dll
installutil comMyCom.dll

regsvcs comMyCom.dll

I've tried the above separately in different order nothing seems to work.
When I look at the Object in the Component Services Snapin. I do not see
the
send method for the _comMyCom Interface. I see it for the IcomMyCom
interface.



What Gives?



Any tips would be appreciated!



Scott<-



--------------------------------------------------------------------------
--

AssemblyInfo.vb

--------------------------------------------------------------------------
--

Imports System

Imports System.Reflection

Imports System.Runtime.InteropServices

Imports System.EnterpriseServices

Imports System.EnterpriseServices.ActivationOption

Imports System.EnterpriseServices.AccessChecksLevelOption



' General Information about an assembly is controlled through the
following

' set of attributes. Change these attribute values to modify the
information

' associated with an assembly.

' Review the values of the assembly attributes

Assembly: AssemblyTitle("ComMyCom")

Assembly: AssemblyDescription("")

Assembly: AssemblyCompany("E&M Electric, Inc.")

Assembly: AssemblyProduct("")

Assembly: AssemblyCopyright("2003")

Assembly: AssemblyTrademark("")

Assembly: CLSCompliant(True)

'The following GUID is for the ID of the typelib if this project is
exposed
to COM

Assembly: Guid("8A4F863A-1CD4-4E8E-942C-912EF1B1D975")

'<Assembly: ApplicationAccessControl(True)

Assembly: ApplicationAccessControl(True)

#Region "COM+ Registration details "

'Supply the COM+ application name

Assembly: ApplicationNameAttribute("ComMyCom")

Assembly: ApplicationActivation(ActivationOption.Server)

'Supply a strong-name assembly

Assembly: AssemblyKeyFileAttribute("..\\..\\comMyCom.snk")

#End Region





' Version information for an assembly consists of the following four
values:

'

' Major Version

' Minor Version

' Build Number

' Revision

'

' You can specify all the values or you can default the Build and Revision
Numbers

' by using the '*' as shown below:

Assembly: AssemblyVersion("1.0.*")





--------------------------------------------------------------------------
--

comMyCom.vb

--------------------------------------------------------------------------
--

Option Explicit On

Option Strict On

Imports System

Imports System.web.mail

Imports System.EnterpriseServices

Imports System.EnterpriseServices.ActivationOption

Imports System.EnterpriseServices.EventTrackingEnabledAttr ibute

Imports System.Reflection

Imports System.Runtime.InteropServices

Imports System.Runtime.InteropServices.ClassInterfaceType



Public Interface IcomMyCom

Function Send(ByVal strEmailAddress As String, ByVal strEmailServer As
String) As Boolean

End Interface



' I've tied the three Attributes with all the same results....

'<ComClass(comMyCom.ClassId, comMyCom.InterfaceId, comMyCom.EventsId)> _

'Public Class comMyCom

'<ClassInterfaceAttribute(ClassInterfaceType.AutoD ual)> _

'Public Class comMyCom

TransactionAttribute(TransactionOption.Required)> _

Public Class comMyCom

Inherits EnterpriseServices.ServicedComponent

Implements IcomMyCom

'Inherits ServicedComponent

' Use the Region directive to define a section named COM Guids.

#Region "COM GUIDs"

' These GUIDs provide the COM identity for this class

' and its COM interfaces. You can generate

' these guids using guidgen.exe

Public Const ClassId As String = "6983A5C3-6E8A-46d9-90B3-4426BE69588C"

Public Const InterfaceId As String =
"5203E497-075F-4f6f-9A25-B697A0C38A6D"

Public Const EventsId As String = "F871F568-5407-4f34-BF00-1A2BDAEC03F1"

#End Region



Public Sub New()

MyBase.New()

End Sub



Public Function Send(ByVal strEmailAddress As String, ByVal strEmailServer
As String) As Boolean Implements IcomMyCom.Send

Send = True

End Function

End Class







Reply With Quote
  #3  
Old   
Mike Dice [MSFT]
 
Posts: n/a

Default Re: Is there Sample Code for creating a Object for use with IIS and ASP (Not ASp.Net)? - 07-30-2003 , 10:34 AM



Scott,
Please have a look at this article in the .Net SDK docs too about exposing
..Net objects to COM. That is what you are really doing.

http://msdn.microsoft.com/library/en...p?frame =true

Mike

"Scott Townsend" <scott@-NO-SPAM.serra.com> wrote

Quote:
I'm trying to write a COM Object in VB .NET and not having the best of
luck.



I'm not 100% sure that I have the Code writen properly to expose the
methods
in my object or if I'm just not registering the dll properly on the Target
machine.



I've included the Code for the Object below. Does it Look fine?



I then register it on the Target machine with the following:

regasm comMyCom.dll /tlb:comMyCom.tlb /codebase
gacutil /i comMyCom.dll
installutil comMyCom.dll

regsvcs comMyCom.dll

I've tried the above separately in different order nothing seems to work.
When I look at the Object in the Component Services Snapin. I do not see
the
send method for the _comMyCom Interface. I see it for the IcomMyCom
interface.



What Gives?



Any tips would be appreciated!



Scott<-



--------------------------------------------------------------------------
--

AssemblyInfo.vb

--------------------------------------------------------------------------
--

Imports System

Imports System.Reflection

Imports System.Runtime.InteropServices

Imports System.EnterpriseServices

Imports System.EnterpriseServices.ActivationOption

Imports System.EnterpriseServices.AccessChecksLevelOption



' General Information about an assembly is controlled through the
following

' set of attributes. Change these attribute values to modify the
information

' associated with an assembly.

' Review the values of the assembly attributes

Assembly: AssemblyTitle("ComMyCom")

Assembly: AssemblyDescription("")

Assembly: AssemblyCompany("E&M Electric, Inc.")

Assembly: AssemblyProduct("")

Assembly: AssemblyCopyright("2003")

Assembly: AssemblyTrademark("")

Assembly: CLSCompliant(True)

'The following GUID is for the ID of the typelib if this project is
exposed
to COM

Assembly: Guid("8A4F863A-1CD4-4E8E-942C-912EF1B1D975")

'<Assembly: ApplicationAccessControl(True)

Assembly: ApplicationAccessControl(True)

#Region "COM+ Registration details "

'Supply the COM+ application name

Assembly: ApplicationNameAttribute("ComMyCom")

Assembly: ApplicationActivation(ActivationOption.Server)

'Supply a strong-name assembly

Assembly: AssemblyKeyFileAttribute("..\\..\\comMyCom.snk")

#End Region





' Version information for an assembly consists of the following four
values:

'

' Major Version

' Minor Version

' Build Number

' Revision

'

' You can specify all the values or you can default the Build and Revision
Numbers

' by using the '*' as shown below:

Assembly: AssemblyVersion("1.0.*")





--------------------------------------------------------------------------
--

comMyCom.vb

--------------------------------------------------------------------------
--

Option Explicit On

Option Strict On

Imports System

Imports System.web.mail

Imports System.EnterpriseServices

Imports System.EnterpriseServices.ActivationOption

Imports System.EnterpriseServices.EventTrackingEnabledAttr ibute

Imports System.Reflection

Imports System.Runtime.InteropServices

Imports System.Runtime.InteropServices.ClassInterfaceType



Public Interface IcomMyCom

Function Send(ByVal strEmailAddress As String, ByVal strEmailServer As
String) As Boolean

End Interface



' I've tied the three Attributes with all the same results....

'<ComClass(comMyCom.ClassId, comMyCom.InterfaceId, comMyCom.EventsId)> _

'Public Class comMyCom

'<ClassInterfaceAttribute(ClassInterfaceType.AutoD ual)> _

'Public Class comMyCom

TransactionAttribute(TransactionOption.Required)> _

Public Class comMyCom

Inherits EnterpriseServices.ServicedComponent

Implements IcomMyCom

'Inherits ServicedComponent

' Use the Region directive to define a section named COM Guids.

#Region "COM GUIDs"

' These GUIDs provide the COM identity for this class

' and its COM interfaces. You can generate

' these guids using guidgen.exe

Public Const ClassId As String = "6983A5C3-6E8A-46d9-90B3-4426BE69588C"

Public Const InterfaceId As String =
"5203E497-075F-4f6f-9A25-B697A0C38A6D"

Public Const EventsId As String = "F871F568-5407-4f34-BF00-1A2BDAEC03F1"

#End Region



Public Sub New()

MyBase.New()

End Sub



Public Function Send(ByVal strEmailAddress As String, ByVal strEmailServer
As String) As Boolean Implements IcomMyCom.Send

Send = True

End Function

End Class







Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.