Groups | Blog | Home
all groups > dotnet distributed apps > april 2008 >

dotnet distributed apps : My Serviced component doesn't expose any methods!


kkarre
4/3/2008 4:11:02 AM
Hello,
PLs help:
I have a component written in VB2005. It contains a class that inherits
System.EnterpriseServices.ServicedComponent.
The class contains a default constructor without any parameters or
implementation.
It also contains several public instance methods.
The component installs as a COM+ application under Component Services on an
XP machine, with all interfaces present.
However, the class interface (_classname) exposes no methods at all!
Could anyone please advice on how to address this.

stcheng@online.microsoft.com
4/4/2008 3:49:58 AM
Hi Karre,

From your description, you're encountering some error when try calling a
..NET serviced component ,correct?

Based on my experience, for serviced component, you can check the following
things to see whether there is anything incorrect:

** the attributes and class/method setting in the serviced component
asssembly. Have you marked the class and methods as public, whether the
class is COM visible or have you apply a strong-name for the assembly

** the deployment of the serviced component assembly. Whether you've added
the assemly into GAC(better to do this), and did you use regsvcs to
explicitly install it(any error or warning occurs)?

Here is a simple test serviced component I've used which worked correct on
a local XP box:

================================
Imports System.EnterpriseServices
Imports System.Data.SqlClient
Imports System.IO
Imports System.Runtime.InteropServices

<ComVisible(True)> _
<Transaction(TransactionOption.RequiresNew)> _
Public Class VBServCom
Inherits EnterpriseServices.ServicedComponent

Public Sub New()


End Sub

<AutoComplete()> _
Public Sub DoTxAuto()

Dim sw As New StreamWriter("e:\temp\servicedcomponent.log")
sw.WriteLine("VBServCom+DoTxAuto: {0}", Date.Now)
sw.Close()

End Sub

End Class


================================


========in assemblyInfo,vb===============

<Assembly: ComVisible(False)>
<Assembly: ApplicationActivation(ActivationOption.Library)>
<Assembly: ApplicationName("SimpleTrans")>
<Assembly: Description("Simple Transactional application to show Enterprise
Services")>

============

also, I applied a strong-name to the assembly and installed it into GAC.

here is another web thread mentioend some potential problem which may be
also helpful:

#ServicedComponent RegistrationException - Invalid Derived Classes
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=138251&SiteID=1

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
[quoted text, click to view]
kkarre
4/4/2008 10:25:00 AM
I believe COMVisible attribute is what I forgot!
I'll check on Monday!
Thanks!

[quoted text, click to view]
stcheng@online.microsoft.com
4/7/2008 1:28:47 AM
Thanks for your reply Karre,

BTW, you can apply ComVisible attribute at both class level and assembly
level, make sure you properly set both ones. You can refer to the examples
I pasted previously. Feel free to let me know if you've got it resolved.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

[quoted text, click to view]
kkarre
4/7/2008 3:19:00 AM
I'm not sure if my previous post disappeared:
When using regsvcs I get a Warning:
"The assembly does not declare an ApplicationAccessControl Attribute.
Application security will be enabled by default.
No matter how I apply these settings I get the same warning.
?
/kk

[quoted text, click to view]
kkarre
4/7/2008 3:49:01 AM
Error code 80020009 turned up at one try, when trying to install into COM+.

[quoted text, click to view]
kkarre
4/7/2008 4:53:01 AM
Intriguing:
I backed down, tried to install your sample component in my COM+.
gacutil returns "Assembly successfully added to the cache."
regsvcs returns "WARNING: The assembly does not declare an
ApplicationAccessControl Attribute. Application security will be enabled by
default."

!!!
So, is it my environment?
Some setting from my VB6 COM+ component?
Or what?
?
/kk

[quoted text, click to view]
kkarre
4/7/2008 6:06:01 AM
....and afterwards gacutil cannot uninstall it!
Number of files: 0
Gaaaaaaaaah!

[quoted text, click to view]
kkarre
4/8/2008 12:24:00 AM
Hi Steven, thanks for your reply!
I did apply the <Assembly:
ApplicationAccessControl(AccessChecksLevelOption.Application)> setting in my
component
but somehow it didn't "stick". It seems to take a while, maybe today...
Your component installs fine in GAC today, d&d or gacutil equally works fine.
However when I add it to a COM+ application in Component Services there's
trouble: I get all interfaces, including the class interface _TestClass.
All interfaces show their methods EXCEPT the class interface.

Am I adding it the wrong way? I use 'Install New Component' and I browse to
the
dll I used as original and drag'n'dropped it into GAC. The wizard won't let
me select the one inside the GAC.

As for VB6, my project is migrating a VB6 COM+ installed component of 30+
dlls.
The code is now in VB2005 but I thought that the Upgrade Wizard might have
brought a component setting or something from VB6 to VB2005.

I've tried calling the component anyway but gets error of kind
"couldn't create ActiveX component". This might be because the VB2005 dll
references three COM components still in VS6/C++ through COMInterop.
Perhaps it's impossible to use COMInterop inside COM+?
Wouldn't be logical - that's the perfect place for COM Interop; large
enterprise apps
where you migrate step by step.

I'd be happy to try your code on my machine to rule out funny policies or
something on my machine.

Thanks in advance!
/kk

[quoted text, click to view]
kkarre
4/8/2008 12:31:00 AM
One step closer:
I added ProgID attribute to your code and got my client to work!

[quoted text, click to view]
kkarre
4/8/2008 3:51:01 AM
I have used both regsvcs and the COM+ UI.
regsvcs returns a happy message but I can't see the COM+ application that
has the installed component.
The people that will maintain this solution wanted to see the COM+ application
and components/interface/methods in it, so I tried that with COM+ Management
console.
I'll try to read up on regsvcs to see how COM+ Management Console can show the
installed component!
Thanks!

[quoted text, click to view]
stcheng@online.microsoft.com
4/8/2008 5:45:35 AM
Hi Kkarre,

I'm sorry to hear that it still not work. As for the warning you mentioned
below:

==========
ns "WARNING: The assembly does not declare an
ApplicationAccessControl Attribute. Application security will be enabled by
default."
=======

I also got this warning since this is a simple test assembly. I ignored
this warning when testing. You can add the following attribute in
AssemblyInfo.vb file so as to eliminate the warning:

=================
<Assembly: ApplicationAccessControl(AccessChecksLevelOption.Application)>
========================

Also, for gacutil, I haven't used it, but directly add/remove the
strong-named dll via drag/drop in the c:\windows\assembly folder. I've
also tried using GacUtil.exe to add/remove the assembly and it also worked.
BTW, as you mentioned:

============
[quoted text, click to view]
===========

i"m not sure whether there is anything involved VB6 here? So far my testing
is through a Enterprised component assembly created via VB.NET class
library project. For VB6 dll it can not be used via those .NET tools such
as GACutil or regsvcs

If necessary, I can send you the test component I used on my side.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

This posting is provided "AS IS" with no warranties, and confers no rights.



--------------------
[quoted text, click to view]
stcheng@online.microsoft.com
4/8/2008 9:33:15 AM
Thanks for your reply Karre,

So the problem is at the Com+ registring stage. Why did you manually
register it into COM+ applications? As I mentioned in previous messages,
in my test, I used the .NET framework regsvcs.exe tool to install the
serviced component into COM+ applications.

#.NET Services Installation Tool (Regsvcs.exe)
http://msdn2.microsoft.com/en-us/library/04za0hca(VS.80).aspx

The command is quite simple. For example, for my case the serviced
component is named "SVCCOMLib.dll", I just run the following command in
Visual Studio command prompt:

regsvcs.exe SVCCOMLib.dll

and it will automatically do all the things without requiring me to do
anything in the COM+ management console.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
[quoted text, click to view]
<JZQ$7bglIHA.3756@TK2MSFTNGHUB02.phx.gbl>
<6E5901C9-88E9-4887-B684-AC51C1EBC752@microsoft.com>
<6980661C-663C-411F-B4F2-33C8836636C2@microsoft.com>
<gb1SHvTmIHA.9932@TK2MSFTNGHUB02.phx.gbl>
[quoted text, click to view]
stcheng@online.microsoft.com
4/10/2008 4:29:37 AM
Hi Karre,

Have you got any progress on this?
When you use regsvcs.exe to install the servicedcomponent into COM+
applications, it will create the COM+ application by the name you specified
through

<Assembly:ApplicationName("...." )>

attribute(not the class name or assembly name), have you checked to see
whether there is a COM+ application with this name? Also, are you using an
administrator account when perform these tasks on the machine?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
[quoted text, click to view]
<JZQ$7bglIHA.3756@TK2MSFTNGHUB02.phx.gbl>
<6E5901C9-88E9-4887-B684-AC51C1EBC752@microsoft.com>
<6980661C-663C-411F-B4F2-33C8836636C2@microsoft.com>
<gb1SHvTmIHA.9932@TK2MSFTNGHUB02.phx.gbl>
<5D2DDD7B-9EC9-44CD-A340-1DD8ECFC351D@microsoft.com>
<Dqm0euVmIHA.1036@TK2MSFTNGHUB02.phx.gbl>
[quoted text, click to view]
stcheng@online.microsoft.com
4/14/2008 11:04:18 AM
Hi Karre,

I'm still monitoring the issue, have you got any progress?

If there is anything else we can help, welcome to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
[quoted text, click to view]
AddThis Social Bookmark Button