Question Class Library DLL and Component Services

rrrctraptor31

New member
Joined
Nov 24, 2009
Messages
1
Programming Experience
5-10
Hey all,

I am having an issue...I have a DLL file i have made in VS2008...builds with no errors...but when i go to add it to my servers component services i get an error...i have attached a screen shot of where i am getting the error and what the error is...i even tried to make a simple single class dll with the following:

VB.NET:
Public Class Class1
    Public Sub New()
    End Sub
    Public Function grrr(ByVal markr As String) As String
        grrr = ""
        For x = Len(markr) To 1 Step -1
            grrr += Mid(markr, x, 1)
        Next
    End Function
End Class
what do i need to do to get this to work???
 

Attachments

  • compluserror.jpg
    compluserror.jpg
    188.2 KB · Views: 32
Your class needs to inherit ServicedComponent Class (System.EnterpriseServices)
VB.Net version of the sample:
VB.NET:
Imports System.EnterpriseServices

<Assembly: ApplicationName("Calculator")> 
<Assembly: ApplicationActivation(ActivationOption.Library)> 
<Assembly: ApplicationAccessControl(True)> 

Public Class Calculator
    Inherits ServicedComponent

    Public Function Add(ByVal x As Integer, ByVal y As Integer) As Integer
        Return x + y
    End Function

End Class
You need to add reference to System.EnterpriseServices.
In addition the assembly must be signed, this can be done in project properties Signing page instead of using the AssemblyKeyFile attribute.
Also in project properties Application page click 'Assembly Information' and check "Make assembly COM-Visible".
I included the ApplicationAccessControl attribute to get rid of the registration warning about default security.
Now the built dll can be registered with .NET Services Installation Tool (Regsvcs.exe) or manually in Component Services console.

There is also this article: How to create a serviced .NET component in Visual Basic.NET or Visual Basic 2005
 
Back
Top