473,883 Members | 1,521 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

com+, what more are needed?

Hello

I'm trying to build a simple COM+ app in vs.net using C# and i cant register
it in component manager.....

what more is needed than this:

using System;

using System.Enterpri seServices;

namespace COMTest

{

/// <summary>

/// Summary description for Class1.

/// </summary>

public class Class1

{

public Class1() {}

public string WriteShit()

{

return "shite";

}

}

}
Nov 15 '05
26 4522
> Cryptographic failure while signing assembly 'C:\Documents and
Settings\Admini strator\My Documents\Visua l Studio
Projects\COMTes t\obj\Release\C OMTest.dll' -- 'The key container name
'COMPlus' does not exist'
If you are building with VS.NET it builds in the obj directory. If you have
the strong key-pair file in the main directory the directive must be
[assembly: AssemblyKeyFile ("..\..\COMTest .snk")]

Adjust for your use

--
Sam Gentile [C#/.NET MVP]
..NET Blog http://samgentile.com/blog/
MSDN Column:
http://msdn.microsoft.com/library/de...tml/bridge.asp
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
"Lasse Edsvik" <la***@nospam.c om> wrote in message
news:eU******** ******@TK2MSFTN GP12.phx.gbl... I got this error when building it:

Cryptographic failure while signing assembly 'C:\Documents and
Settings\Admini strator\My Documents\Visua l Studio
Projects\COMTes t\obj\Release\C OMTest.dll' -- 'The key container name
'COMPlus' does not exist'


"Sam Gentile [MVP]" <sa*@nomail.com > wrote in message
news:eT******** ******@tk2msftn gp13.phx.gbl...
I've updated my blog topic.

--
Sam Gentile [C#/.NET MVP]
.NET Blog http://samgentile.com/blog/
MSDN Column:

http://msdn.microsoft.com/library/de...tml/bridge.asp
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no

rights.

"Sam Gentile [MVP]" <sa*@nomail.com > wrote in message
news:en******** ******@TK2MSFTN GP10.phx.gbl...
Are you creating a COM+ server or library component? It makes a

difference.
This is controlled by:
[assembly: ApplicationActi vation(Activati onOption.Server )]

Or

[assembly: ApplicationActi vation(Activati onOption.Librar y)]

While convenient, the lazy registration in step 9 does not work in many scenarios as it requires Admin rights as well as other issues. So really
the
right way. So the correct way that will work in all scenarios is
replace step 9 by:

9) gacutil.exe - i COMtest.dll (this puts it in the GAC)

10) regsvcs.exe COMtest.sll (this makes it a configured
coomponent in the COM+ catalog)
--
Sam Gentile [C#/.NET MVP]
.NET Blog http://samgentile.com/blog/
MSDN Column:

http://msdn.microsoft.com/library/de...tml/bridge.asp
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no

rights.
"Lasse Edsvik" <la***@nospam.c om> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
> Sam,
>
> hmm, i fail at step 9 eventhough i've created COMTest.snk, should it be
in
> AssemblyInfo.cs ?
>
>
> looks like this now:
>
> using System;
>
> using System.Enterpri seServices;
>
> [assembly: ApplicationName ("COMTest")]
>
> [assembly: AssemblyKeyFile ("COMTest.sn k")]
>
> namespace COMTest
>
> {
>
> public class Class1 : ServicedCompone nt
>
> {
>
> public Class1() {}
>
> public string WriteShit()
>
> {
>
> return "shite";
>
> }
>
>
>
>
>
>
>
> in Assemblyinfo.cs its:
>
>
>
>
>
> [assembly: AssemblyDelaySi gn(false)]
>
> [assembly: AssemblyKeyFile ("")]
>
> [assembly: AssemblyKeyName ("")]
>
>
>
>
>
> "Sam Gentile [MVP]" <sa*@nomail.com > wrote in message
> news:uC******** *****@TK2MSFTNG P12.phx.gbl...
> > You are missing a few steps, basically the assembly attributes so

that > "Lazy
> > registration" can occur in the COM+ catalog. Without that step you

have
to
> > do an explicit regsvcs.exe. Here are the steps from a blog post of

mine:
> > 1.. Create a DLL project
> > 2.. Add a Reference to System.Enterpri seServices
> > 3.. Add a using declaration: using System.Enterpri seServices;
> > 4.. Inherit your classes from ServicedCompone nt (i.e. public Widget
:
> > ServicedCompone nt)
> > 5.. Stick an [assembly: ApplicationName ("ComPlusApp ")] at the top so > that
> > "COMPlusApp " or whatever is the name of the application when it is
> > registered in the COM+ catalog.
> > 6.. Stick a strong name attribute at the top of the file [assembly: > > AssemblyKeyFile ("ComPlus.sn k")]
> > 7.. Go to the command line and generate a Strong Name sn -k
ComPlus.snk
> > 8.. If you have some method that performs a transaction, put
> > [AutoComplete] on top of it
> > 9.. Build - This will lazy register the COM+ app in the COM+ catalog (In
> > some circumstances I will go into detail in a future article, you may have
> > to do use regsvcs.exe ComPlusApp.dll)
> > 10.. Create a client that references System.Enterpri seServices
and calls
> > your COM+ method(s)
> > 11.. Run it
> > See http://samgentile.com/blog/archive/2003/06/25/7844.aspx
> >
> > ----
> > Sam Gentile [C#/.NET MVP]
> > .NET Blog http://samgentile.com/blog/
> > MSDN Column:
> >
>

http://msdn.microsoft.com/library/de...tml/bridge.asp
> > Please reply only to the newsgroup so that others can benefit.
> > This posting is provided "AS IS" with no warranties, and confers no > rights.
> > ------
> >
> >
> > "Lasse Edsvik" <la***@nospam.c om> wrote in message
> > news:uS******** ********@TK2MSF TNGP09.phx.gbl. ..
> > > Aravind,
> > >
> > > i still get "One or more files do not contain components or type
> > libraries.
> > > These files cannot be installed" :(
> > >
> > > I assume that assembly stuff is just for transactions?
> > >
> > > cant find a simple hello world app om msdn, its a djungle......
> > >
> > > /Lasse
> > >
> > >
> > > "Aravind C" <ar***********@ nospam.hotmail. com> wrote in message
> > > news:OD******** ******@TK2MSFTN GP12.phx.gbl...
> > > > HI Lasse,
> > > >
> > > > You must also derive your class from ServicedCompone nt.
> > > >
> > > > public class Class1 : ServicedCompone nt
> > > > {
> > > > // .....
> > > > }
> > > >
> > > > The following article will provide a good overview.
> > > >
> > >
> >
>

http://msdn.microsoft.com/library/en...asp?frame=true
> > > >
> > > >
> > > > Regards,
> > > > Aravind C
> > > >
> > > >
> > > > "Lasse Edsvik" <la***@nospam.c om> wrote in message
> > > > news:#H******** ******@TK2MSFTN GP09.phx.gbl...
> > > > > Hello
> > > > >
> > > > > I'm trying to build a simple COM+ app in vs.net using C# and i cant
> > > > register
> > > > > it in component manager.....
> > > > >
> > > > > what more is needed than this:
> > > > >
> > > > > using System;
> > > > >
> > > > > using System.Enterpri seServices;
> > > > >
> > > > > namespace COMTest
> > > > >
> > > > > {
> > > > >
> > > > > /// <summary>
> > > > >
> > > > > /// Summary description for Class1.
> > > > >
> > > > > /// </summary>
> > > > >
> > > > > public class Class1
> > > > >
> > > > > {
> > > > >
> > > > > public Class1() {}
> > > > >
> > > > > public string WriteShit()
> > > > >
> > > > > {
> > > > >
> > > > > return "shite";
> > > > >
> > > > > }
> > > > >
> > > > > }
> > > > >
> > > > > }
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #11
"Lasse Edsvik" <la***@nospam.c om> wrote:
Sam,

trying to build a simple COM app that i'll use in regular ASP-pages

/Lasse


Now I'm confused. So far it looked like you were trying to create a Serviced Component.
Now it sounds like you are trying to build a COM library for a scripted environment.

COM+ (and hence enterprise services) evolved from MTS, not COM (it simply uses COM).

Are you talking about ASP or ASP.NET? If you are talking about ASP.NET then a serviced component
can be used but so can any .NET "component" . What features of the enterprise services
environment do you want to use?

Are you talking about old style ASP? Are trying to expose a .NET assembly to COM?

Then you may find the following interesting:

NET Framework Developer's Guide: Exposing .NET Framework Components to COM
http://msdn.microsoft.com/library/de...nentstocom.asp

NET Framework Developer's Guide: Packaging an Assembly for COM
http://msdn.microsoft.com/library/de...mblyforcom.asp
++ From: Alex K. Angelopoulos \(MVP\) (ak*@mvps.org)
++ Subject: Building WSH-usable .NET components from the redistributable s, revisited
++ Newsgroups: microsoft.publi c.dotnet.script ing, microsoft.publi c.scripting.vbs cript,
++ microsoft.publi c.scripting.wsh , microsoft.publi c.windows.serve r.scripting, microsoft.publi c.scripting.jsc ript
++ Date: 2003-03-14 18:51:04 PST
++
++ [due to potential interest, cross-posted to microsoft.publi c.dotnet.script ing,
++ microsoft.publi c.scripting.vbs cript, microsoft.publi c.scripting.wsh ,
++ microsoft.publi c.windows.serve r.scripting, microsoft.publi c.scripting.jsc ript.
++ FOLLOWUP set to .wsh only]
++
++ Several days ago I made a couple of posts about building WSH (actually generic
++ COM) scriptable .NET components using the compilers built into the
++ redistributable . This is a followup detailing a somewhat cleaner method for
++ doing this. It will work with the C#, VB.NET, and JScript.NET compilers
++ currently.
++
++ The process involves compilation of a simple class file, then registering its
++ codebase. This means there is minimal name protection, so be certain to use a
++ long, unique class name!! The lack of strong naming means this is best targeted
++ at on-the-fly creation of "anonymous" COM classes which will be removed after
++ use; in fact, as I try to generalize the technique, it will be best to include
++ strong naming as a feature.
++
++ In any case, below is a generic batch file for creating the DLLs, followed by
++ brief demos in each of the 3 compilers mentioned. Comments welcome; followups
++ are set to microsoft.publi c.scripting.wsh .
++
++ =============== =============== =============== =========
++
++ 1. Compilation into a COM-Callable Library
++
++ There are two simple steps: compile to a library, and then register the
++ codebase. The batch file shown below will do this given a source file name as
++ an argument; it determines which compiler to call based on the source file's
++ extension. The compiled DLL will have the same base name as the source file.
++
++ @echo off
++ :: generic .NET library compiler script
++ :: get the extension into %ext%
++ set srcfile=%1
++ set ext=%srcfile:~-2%
++
++ :: get the basename into %basename%
++ CALL SET basename=%srcfi le:~0,-3%%
++ echo basename is %basename%
++
++ :: set the correct compiler
++ set exc=%ext%c
++
++ %exc% /nologo /t:library %basename%.%ext %
++ regasm /nologo /codebase %basename%.dll
++
++ 2. Run A Script Calling The Library.
++
++ If the class is named "thisismycl ass" and it exposes a public function
++ "testfuncti on", you can run it from VBScript like this:
++
++ set cls = CreateObject("t hisismyclass")
++ rtn = cls.testfunctio n
++
++
++ Demo classfile sources and VBScript demos are included below for the
++ Jscript.NET, C#, and VB.NET.
++
++
++ %---------- Test Jscript.NET Class File ----------
++ class testcompiledjsc riptnet
++ {
++ public function testreturn()
++ {
++ // display the number of commandline items
++ return("this is a string returned from a Jscript.Net library.");
++ }
++ }
++ %---------- VBScript to test Jscript.NET Library ----------
++ set js = CreateObject("t estcompiledjscr iptnet")
++ wscript.echo js.testreturn
++
++
++
++ %---------- Test C# Class File ----------
++ public class testcompiledcsh arpnet
++ {
++ public string testreturn()
++ {
++ return("this is a string returned from a C# library.");
++ }
++ }
++
++
++ %---------- VBScript to test C# Library ----------
++ set cs = CreateObject("t estcompiledcsha rpnet")
++ wscript.echo cs.testreturn
++
++ %---------- Test VB.NET Class File ----------
++ ' Test
++ public class testcompiledvbn et
++ public function testreturn() as string
++ return("this is a string returned from a VB.Net library.")
++ end function
++ end class
++ %---------- VBScript to test VB.NET Library ----------
++ set vb = CreateObject("t estcompiledvbne t")
++ wscript.echo vb.testreturn
++
++
++
++
++
++
++
++ --
++ Please respond in the newsgroup so everyone may benefit.
++ http://dev.remotenetworktechnology.com
++ (email requests for support contract information welcomed)
++ ----------
++ Subscribe to Microsoft's Security Bulletins:
++ http://www.microsoft.com/technet/sec...tin/notify.asp

Nov 15 '05 #12
Didn't the compilation error tell you something like "Are you missing a
reference..."

If you look up AssemblyKeyFile attribute it is in System.Reflecti on.

So add:
using System.Reflecti on;

at the top

--
Sam Gentile [C#/.NET MVP]
..NET Blog http://samgentile.com/blog/
MSDN Column:
http://msdn.microsoft.com/library/de...tml/bridge.asp
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
"Lasse Edsvik" <la***@nospam.c om> wrote in message
news:eF******** ******@TK2MSFTN GP09.phx.gbl...
C:\Documents and Settings\Admini strator\My Documents\Visua l Studio
Projects\COMTes t\COMTest.cs(7) : The type or namespace name 'AssemblyKeyFil e' could not be found (are you missing a using directive or an assembly
reference?)
and that one....... :(

/Lasse
"Lasse Edsvik" <la***@nospam.c om> wrote in message
news:eU******** ******@TK2MSFTN GP12.phx.gbl...
I got this error when building it:

Cryptographic failure while signing assembly 'C:\Documents and
Settings\Admini strator\My Documents\Visua l Studio
Projects\COMTes t\obj\Release\C OMTest.dll' -- 'The key container name
'COMPlus' does not exist'


"Sam Gentile [MVP]" <sa*@nomail.com > wrote in message
news:eT******** ******@tk2msftn gp13.phx.gbl...
I've updated my blog topic.

--
Sam Gentile [C#/.NET MVP]
.NET Blog http://samgentile.com/blog/
MSDN Column:

http://msdn.microsoft.com/library/de...tml/bridge.asp
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no

rights.

"Sam Gentile [MVP]" <sa*@nomail.com > wrote in message
news:en******** ******@TK2MSFTN GP10.phx.gbl...
> Are you creating a COM+ server or library component? It makes a
difference.
> This is controlled by:
> [assembly: ApplicationActi vation(Activati onOption.Server )]
>
> Or
>
> [assembly: ApplicationActi vation(Activati onOption.Librar y)]
>
>
>
> While convenient, the lazy registration in step 9 does not work in many > scenarios as it requires Admin rights as well as other issues. So really the
> right way. So the correct way that will work in all scenarios is replace > step 9 by:
>
> 9) gacutil.exe - i COMtest.dll (this puts it in the GAC)
>
> 10) regsvcs.exe COMtest.sll (this makes it a configured
> coomponent in the COM+ catalog)
>
>
> --
> Sam Gentile [C#/.NET MVP]
> .NET Blog http://samgentile.com/blog/
> MSDN Column:
>

http://msdn.microsoft.com/library/de...tml/bridge.asp
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> "Lasse Edsvik" <la***@nospam.c om> wrote in message
> news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
> > Sam,
> >
> > hmm, i fail at step 9 eventhough i've created COMTest.snk, should it
be
in
> > AssemblyInfo.cs ?
> >
> >
> > looks like this now:
> >
> > using System;
> >
> > using System.Enterpri seServices;
> >
> > [assembly: ApplicationName ("COMTest")]
> >
> > [assembly: AssemblyKeyFile ("COMTest.sn k")]
> >
> > namespace COMTest
> >
> > {
> >
> > public class Class1 : ServicedCompone nt
> >
> > {
> >
> > public Class1() {}
> >
> > public string WriteShit()
> >
> > {
> >
> > return "shite";
> >
> > }
> >
> >
> >
> >
> >
> >
> >
> > in Assemblyinfo.cs its:
> >
> >
> >
> >
> >
> > [assembly: AssemblyDelaySi gn(false)]
> >
> > [assembly: AssemblyKeyFile ("")]
> >
> > [assembly: AssemblyKeyName ("")]
> >
> >
> >
> >
> >
> > "Sam Gentile [MVP]" <sa*@nomail.com > wrote in message
> > news:uC******** *****@TK2MSFTNG P12.phx.gbl...
> > > You are missing a few steps, basically the assembly attributes
so
that
> > "Lazy
> > > registration" can occur in the COM+ catalog. Without that step
you have
> to
> > > do an explicit regsvcs.exe. Here are the steps from a blog post of mine:
> > > 1.. Create a DLL project
> > > 2.. Add a Reference to System.Enterpri seServices
> > > 3.. Add a using declaration: using System.Enterpri seServices;
> > > 4.. Inherit your classes from ServicedCompone nt (i.e. public

Widget
:
> > > ServicedCompone nt)
> > > 5.. Stick an [assembly: ApplicationName ("ComPlusApp ")] at the

top
so
> > that
> > > "COMPlusApp " or whatever is the name of the application when it is > > > registered in the COM+ catalog.
> > > 6.. Stick a strong name attribute at the top of the file

[assembly:
> > > AssemblyKeyFile ("ComPlus.sn k")]
> > > 7.. Go to the command line and generate a Strong Name sn -k
> ComPlus.snk
> > > 8.. If you have some method that performs a transaction, put
> > > [AutoComplete] on top of it
> > > 9.. Build - This will lazy register the COM+ app in the COM+

catalog
> (In
> > > some circumstances I will go into detail in a future article, you may
> have
> > > to do use regsvcs.exe ComPlusApp.dll)
> > > 10.. Create a client that references System.Enterpri seServices

and > calls
> > > your COM+ method(s)
> > > 11.. Run it
> > > See http://samgentile.com/blog/archive/2003/06/25/7844.aspx
> > >
> > > ----
> > > Sam Gentile [C#/.NET MVP]
> > > .NET Blog http://samgentile.com/blog/
> > > MSDN Column:
> > >
> >
>

http://msdn.microsoft.com/library/de...tml/bridge.asp > > > Please reply only to the newsgroup so that others can benefit.
> > > This posting is provided "AS IS" with no warranties, and confers no > > rights.
> > > ------
> > >
> > >
> > > "Lasse Edsvik" <la***@nospam.c om> wrote in message
> > > news:uS******** ********@TK2MSF TNGP09.phx.gbl. ..
> > > > Aravind,
> > > >
> > > > i still get "One or more files do not contain components or type > > > libraries.
> > > > These files cannot be installed" :(
> > > >
> > > > I assume that assembly stuff is just for transactions?
> > > >
> > > > cant find a simple hello world app om msdn, its a djungle...... > > > >
> > > > /Lasse
> > > >
> > > >
> > > > "Aravind C" <ar***********@ nospam.hotmail. com> wrote in message > > > > news:OD******** ******@TK2MSFTN GP12.phx.gbl...
> > > > > HI Lasse,
> > > > >
> > > > > You must also derive your class from ServicedCompone nt.
> > > > >
> > > > > public class Class1 : ServicedCompone nt
> > > > > {
> > > > > // .....
> > > > > }
> > > > >
> > > > > The following article will provide a good overview.
> > > > >
> > > >
> > >
> >
>

http://msdn.microsoft.com/library/en...asp?frame=true
> > > > >
> > > > >
> > > > > Regards,
> > > > > Aravind C
> > > > >
> > > > >
> > > > > "Lasse Edsvik" <la***@nospam.c om> wrote in message
> > > > > news:#H******** ******@TK2MSFTN GP09.phx.gbl...
> > > > > > Hello
> > > > > >
> > > > > > I'm trying to build a simple COM+ app in vs.net using C#
and i > cant
> > > > > register
> > > > > > it in component manager.....
> > > > > >
> > > > > > what more is needed than this:
> > > > > >
> > > > > > using System;
> > > > > >
> > > > > > using System.Enterpri seServices;
> > > > > >
> > > > > > namespace COMTest
> > > > > >
> > > > > > {
> > > > > >
> > > > > > /// <summary>
> > > > > >
> > > > > > /// Summary description for Class1.
> > > > > >
> > > > > > /// </summary>
> > > > > >
> > > > > > public class Class1
> > > > > >
> > > > > > {
> > > > > >
> > > > > > public Class1() {}
> > > > > >
> > > > > > public string WriteShit()
> > > > > >
> > > > > > {
> > > > > >
> > > > > > return "shite";
> > > > > >
> > > > > > }
> > > > > >
> > > > > > }
> > > > > >
> > > > > > }
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #13
> trying to build a simple COM app that i'll use in regular ASP-pages
Why are using ES/COM+ then? Do you have distributed transactions or other
needs that require COM+/ES services? If not, all you need is COM Interop

--
Sam Gentile [C#/.NET MVP]
..NET Blog http://samgentile.com/blog/
MSDN Column:
http://msdn.microsoft.com/library/de...tml/bridge.asp
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
"Lasse Edsvik" <la***@nospam.c om> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Sam,

trying to build a simple COM app that i'll use in regular ASP-pages

/Lasse
"Sam Gentile [MVP]" <sa*@nomail.com > wrote in message
news:en******** ******@TK2MSFTN GP10.phx.gbl...
Are you creating a COM+ server or library component? It makes a difference.
This is controlled by:
[assembly: ApplicationActi vation(Activati onOption.Server )]

Or

[assembly: ApplicationActi vation(Activati onOption.Librar y)]

While convenient, the lazy registration in step 9 does not work in many
scenarios as it requires Admin rights as well as other issues. So really

the
right way. So the correct way that will work in all scenarios is replace
step 9 by:

9) gacutil.exe - i COMtest.dll (this puts it in the GAC)

10) regsvcs.exe COMtest.sll (this makes it a configured
coomponent in the COM+ catalog)
--
Sam Gentile [C#/.NET MVP]
.NET Blog http://samgentile.com/blog/
MSDN Column:

http://msdn.microsoft.com/library/de...tml/bridge.asp
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no

rights.
"Lasse Edsvik" <la***@nospam.c om> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Sam,

hmm, i fail at step 9 eventhough i've created COMTest.snk, should it be in
AssemblyInfo.cs ?
looks like this now:

using System;

using System.Enterpri seServices;

[assembly: ApplicationName ("COMTest")]

[assembly: AssemblyKeyFile ("COMTest.sn k")]

namespace COMTest

{

public class Class1 : ServicedCompone nt

{

public Class1() {}

public string WriteShit()

{

return "shite";

}



in Assemblyinfo.cs its:

[assembly: AssemblyDelaySi gn(false)]

[assembly: AssemblyKeyFile ("")]

[assembly: AssemblyKeyName ("")]

"Sam Gentile [MVP]" <sa*@nomail.com > wrote in message
news:uC******** *****@TK2MSFTNG P12.phx.gbl...
> You are missing a few steps, basically the assembly attributes so
that "Lazy
> registration" can occur in the COM+ catalog. Without that step you have
to
> do an explicit regsvcs.exe. Here are the steps from a blog post of
mine: > 1.. Create a DLL project
> 2.. Add a Reference to System.Enterpri seServices
> 3.. Add a using declaration: using System.Enterpri seServices;
> 4.. Inherit your classes from ServicedCompone nt (i.e. public Widget :
> ServicedCompone nt)
> 5.. Stick an [assembly: ApplicationName ("ComPlusApp ")] at the top
so that
> "COMPlusApp " or whatever is the name of the application when it is
> registered in the COM+ catalog.
> 6.. Stick a strong name attribute at the top of the file [assembly: > AssemblyKeyFile ("ComPlus.sn k")]
> 7.. Go to the command line and generate a Strong Name sn -k

ComPlus.snk
> 8.. If you have some method that performs a transaction, put
> [AutoComplete] on top of it
> 9.. Build - This will lazy register the COM+ app in the COM+ catalog (In
> some circumstances I will go into detail in a future article, you
may have
> to do use regsvcs.exe ComPlusApp.dll)
> 10.. Create a client that references System.Enterpri seServices and

calls
> your COM+ method(s)
> 11.. Run it
> See http://samgentile.com/blog/archive/2003/06/25/7844.aspx
>
> ----
> Sam Gentile [C#/.NET MVP]
> .NET Blog http://samgentile.com/blog/
> MSDN Column:
>

http://msdn.microsoft.com/library/de...tml/bridge.asp > Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> ------
>
>
> "Lasse Edsvik" <la***@nospam.c om> wrote in message
> news:uS******** ********@TK2MSF TNGP09.phx.gbl. ..
> > Aravind,
> >
> > i still get "One or more files do not contain components or type
> libraries.
> > These files cannot be installed" :(
> >
> > I assume that assembly stuff is just for transactions?
> >
> > cant find a simple hello world app om msdn, its a djungle......
> >
> > /Lasse
> >
> >
> > "Aravind C" <ar***********@ nospam.hotmail. com> wrote in message
> > news:OD******** ******@TK2MSFTN GP12.phx.gbl...
> > > HI Lasse,
> > >
> > > You must also derive your class from ServicedCompone nt.
> > >
> > > public class Class1 : ServicedCompone nt
> > > {
> > > // .....
> > > }
> > >
> > > The following article will provide a good overview.
> > >
> >
>

http://msdn.microsoft.com/library/en...asp?frame=true
> > >
> > >
> > > Regards,
> > > Aravind C
> > >
> > >
> > > "Lasse Edsvik" <la***@nospam.c om> wrote in message
> > > news:#H******** ******@TK2MSFTN GP09.phx.gbl...
> > > > Hello
> > > >
> > > > I'm trying to build a simple COM+ app in vs.net using C# and i

cant
> > > register
> > > > it in component manager.....
> > > >
> > > > what more is needed than this:
> > > >
> > > > using System;
> > > >
> > > > using System.Enterpri seServices;
> > > >
> > > > namespace COMTest
> > > >
> > > > {
> > > >
> > > > /// <summary>
> > > >
> > > > /// Summary description for Class1.
> > > >
> > > > /// </summary>
> > > >
> > > > public class Class1
> > > >
> > > > {
> > > >
> > > > public Class1() {}
> > > >
> > > > public string WriteShit()
> > > >
> > > > {
> > > >
> > > > return "shite";
> > > >
> > > > }
> > > >
> > > > }
> > > >
> > > > }
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #14
As am I,. You said COM+ in your original post. There is a huge difference
between COM and COM+.

--
Sam Gentile [C#/.NET MVP]
..NET Blog http://samgentile.com/blog/
MSDN Column:
http://msdn.microsoft.com/library/de...tml/bridge.asp
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
"UAError" <nu**@null.null > wrote in message
news:3s******** *************** *********@4ax.c om...
"Lasse Edsvik" <la***@nospam.c om> wrote:
Sam,

trying to build a simple COM app that i'll use in regular ASP-pages

/Lasse

Now I'm confused. So far it looked like you were trying to create a

Serviced Component. Now it sounds like you are trying to build a COM library for a scripted environment.
COM+ (and hence enterprise services) evolved from MTS, not COM (it simply uses COM).
Are you talking about ASP or ASP.NET? If you are talking about ASP.NET then a serviced component can be used but so can any .NET "component" . What features of the enterprise services environment do you want to use?

Are you talking about old style ASP? Are trying to expose a .NET assembly to COM?
Then you may find the following interesting:

NET Framework Developer's Guide: Exposing .NET Framework Components to COM
http://msdn.microsoft.com/library/de...nentstocom.asp
NET Framework Developer's Guide: Packaging an Assembly for COM
http://msdn.microsoft.com/library/de...mblyforcom.asp

++ From: Alex K. Angelopoulos \(MVP\) (ak*@mvps.org)
++ Subject: Building WSH-usable .NET components from the redistributable s, revisited ++ Newsgroups: microsoft.publi c.dotnet.script ing, microsoft.publi c.scripting.vbs cript, ++ microsoft.publi c.scripting.wsh , microsoft.publi c.windows.serve r.scripting,
microsoft.publi c.scripting.jsc ript ++ Date: 2003-03-14 18:51:04 PST
++
++ [due to potential interest, cross-posted to microsoft.publi c.dotnet.script ing, ++ microsoft.publi c.scripting.vbs cript, microsoft.publi c.scripting.wsh ,
++ microsoft.publi c.windows.serve r.scripting, microsoft.publi c.scripting.jsc ript. ++ FOLLOWUP set to .wsh only]
++
++ Several days ago I made a couple of posts about building WSH (actually generic ++ COM) scriptable .NET components using the compilers built into the
++ redistributable . This is a followup detailing a somewhat cleaner method for ++ doing this. It will work with the C#, VB.NET, and JScript.NET compilers ++ currently.
++
++ The process involves compilation of a simple class file, then registering its ++ codebase. This means there is minimal name protection, so be certain to use a ++ long, unique class name!! The lack of strong naming means this is best targeted ++ at on-the-fly creation of "anonymous" COM classes which will be removed after ++ use; in fact, as I try to generalize the technique, it will be best to include ++ strong naming as a feature.
++
++ In any case, below is a generic batch file for creating the DLLs, followed by ++ brief demos in each of the 3 compilers mentioned. Comments welcome; followups ++ are set to microsoft.publi c.scripting.wsh .
++
++ =============== =============== =============== =========
++
++ 1. Compilation into a COM-Callable Library
++
++ There are two simple steps: compile to a library, and then register the ++ codebase. The batch file shown below will do this given a source file name as ++ an argument; it determines which compiler to call based on the source file's ++ extension. The compiled DLL will have the same base name as the source file. ++
++ @echo off
++ :: generic .NET library compiler script
++ :: get the extension into %ext%
++ set srcfile=%1
++ set ext=%srcfile:~-2%
++
++ :: get the basename into %basename%
++ CALL SET basename=%srcfi le:~0,-3%%
++ echo basename is %basename%
++
++ :: set the correct compiler
++ set exc=%ext%c
++
++ %exc% /nologo /t:library %basename%.%ext %
++ regasm /nologo /codebase %basename%.dll
++
++ 2. Run A Script Calling The Library.
++
++ If the class is named "thisismycl ass" and it exposes a public function
++ "testfuncti on", you can run it from VBScript like this:
++
++ set cls = CreateObject("t hisismyclass")
++ rtn = cls.testfunctio n
++
++
++ Demo classfile sources and VBScript demos are included below for the
++ Jscript.NET, C#, and VB.NET.
++
++
++ %---------- Test Jscript.NET Class File ----------
++ class testcompiledjsc riptnet
++ {
++ public function testreturn()
++ {
++ // display the number of commandline items
++ return("this is a string returned from a Jscript.Net library.");
++ }
++ }
++ %---------- VBScript to test Jscript.NET Library ----------
++ set js = CreateObject("t estcompiledjscr iptnet")
++ wscript.echo js.testreturn
++
++
++
++ %---------- Test C# Class File ----------
++ public class testcompiledcsh arpnet
++ {
++ public string testreturn()
++ {
++ return("this is a string returned from a C# library.");
++ }
++ }
++
++
++ %---------- VBScript to test C# Library ----------
++ set cs = CreateObject("t estcompiledcsha rpnet")
++ wscript.echo cs.testreturn
++
++ %---------- Test VB.NET Class File ----------
++ ' Test
++ public class testcompiledvbn et
++ public function testreturn() as string
++ return("this is a string returned from a VB.Net library.")
++ end function
++ end class
++ %---------- VBScript to test VB.NET Library ----------
++ set vb = CreateObject("t estcompiledvbne t")
++ wscript.echo vb.testreturn
++
++
++
++
++
++
++
++ --
++ Please respond in the newsgroup so everyone may benefit.
++ http://dev.remotenetworktechnology.com
++ (email requests for support contract information welcomed)
++ ----------
++ Subscribe to Microsoft's Security Bulletins:
++ http://www.microsoft.com/technet/sec...tin/notify.asp

Nov 15 '05 #15
Sam,

in this example i dont have to use transactions... .. so i'll skip that and
learn that some other time then...

how i make this a "regular" COM app?
using System;

using System.Enterpri seServices;

[assembly: ApplicationName ("COMTest")]

[assembly: AssemblyKeyFile ("COMTest.sn k")]

namespace COMTest

{

public class Class1 : ServicedCompone nt

{

public Class1() {}

public string WriteShit()

{

return "shite";

}

}

}

"Sam Gentile [MVP]" <sa*@nomail.com > wrote in message
news:eF******** ******@TK2MSFTN GP09.phx.gbl...
trying to build a simple COM app that i'll use in regular ASP-pages Why are using ES/COM+ then? Do you have distributed transactions or other
needs that require COM+/ES services? If not, all you need is COM Interop

--
Sam Gentile [C#/.NET MVP]
.NET Blog http://samgentile.com/blog/
MSDN Column:

http://msdn.microsoft.com/library/de...tml/bridge.asp Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights. "Lasse Edsvik" <la***@nospam.c om> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Sam,

trying to build a simple COM app that i'll use in regular ASP-pages

/Lasse
"Sam Gentile [MVP]" <sa*@nomail.com > wrote in message
news:en******** ******@TK2MSFTN GP10.phx.gbl...
Are you creating a COM+ server or library component? It makes a difference.
This is controlled by:
[assembly: ApplicationActi vation(Activati onOption.Server )]

Or

[assembly: ApplicationActi vation(Activati onOption.Librar y)]

While convenient, the lazy registration in step 9 does not work in many scenarios as it requires Admin rights as well as other issues. So really
the
right way. So the correct way that will work in all scenarios is
replace step 9 by:

9) gacutil.exe - i COMtest.dll (this puts it in the GAC)

10) regsvcs.exe COMtest.sll (this makes it a configured
coomponent in the COM+ catalog)
--
Sam Gentile [C#/.NET MVP]
.NET Blog http://samgentile.com/blog/
MSDN Column:

http://msdn.microsoft.com/library/de...tml/bridge.asp
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no

rights.
"Lasse Edsvik" <la***@nospam.c om> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
> Sam,
>
> hmm, i fail at step 9 eventhough i've created COMTest.snk, should it be
in
> AssemblyInfo.cs ?
>
>
> looks like this now:
>
> using System;
>
> using System.Enterpri seServices;
>
> [assembly: ApplicationName ("COMTest")]
>
> [assembly: AssemblyKeyFile ("COMTest.sn k")]
>
> namespace COMTest
>
> {
>
> public class Class1 : ServicedCompone nt
>
> {
>
> public Class1() {}
>
> public string WriteShit()
>
> {
>
> return "shite";
>
> }
>
>
>
>
>
>
>
> in Assemblyinfo.cs its:
>
>
>
>
>
> [assembly: AssemblyDelaySi gn(false)]
>
> [assembly: AssemblyKeyFile ("")]
>
> [assembly: AssemblyKeyName ("")]
>
>
>
>
>
> "Sam Gentile [MVP]" <sa*@nomail.com > wrote in message
> news:uC******** *****@TK2MSFTNG P12.phx.gbl...
> > You are missing a few steps, basically the assembly attributes so

that > "Lazy
> > registration" can occur in the COM+ catalog. Without that step you

have
to
> > do an explicit regsvcs.exe. Here are the steps from a blog post of

mine:
> > 1.. Create a DLL project
> > 2.. Add a Reference to System.Enterpri seServices
> > 3.. Add a using declaration: using System.Enterpri seServices;
> > 4.. Inherit your classes from ServicedCompone nt (i.e. public Widget
:
> > ServicedCompone nt)
> > 5.. Stick an [assembly: ApplicationName ("ComPlusApp ")] at the top so > that
> > "COMPlusApp " or whatever is the name of the application when it is
> > registered in the COM+ catalog.
> > 6.. Stick a strong name attribute at the top of the file [assembly: > > AssemblyKeyFile ("ComPlus.sn k")]
> > 7.. Go to the command line and generate a Strong Name sn -k
ComPlus.snk
> > 8.. If you have some method that performs a transaction, put
> > [AutoComplete] on top of it
> > 9.. Build - This will lazy register the COM+ app in the COM+ catalog (In
> > some circumstances I will go into detail in a future article, you may have
> > to do use regsvcs.exe ComPlusApp.dll)
> > 10.. Create a client that references System.Enterpri seServices
and calls
> > your COM+ method(s)
> > 11.. Run it
> > See http://samgentile.com/blog/archive/2003/06/25/7844.aspx
> >
> > ----
> > Sam Gentile [C#/.NET MVP]
> > .NET Blog http://samgentile.com/blog/
> > MSDN Column:
> >
>

http://msdn.microsoft.com/library/de...tml/bridge.asp
> > Please reply only to the newsgroup so that others can benefit.
> > This posting is provided "AS IS" with no warranties, and confers no > rights.
> > ------
> >
> >
> > "Lasse Edsvik" <la***@nospam.c om> wrote in message
> > news:uS******** ********@TK2MSF TNGP09.phx.gbl. ..
> > > Aravind,
> > >
> > > i still get "One or more files do not contain components or type
> > libraries.
> > > These files cannot be installed" :(
> > >
> > > I assume that assembly stuff is just for transactions?
> > >
> > > cant find a simple hello world app om msdn, its a djungle......
> > >
> > > /Lasse
> > >
> > >
> > > "Aravind C" <ar***********@ nospam.hotmail. com> wrote in message
> > > news:OD******** ******@TK2MSFTN GP12.phx.gbl...
> > > > HI Lasse,
> > > >
> > > > You must also derive your class from ServicedCompone nt.
> > > >
> > > > public class Class1 : ServicedCompone nt
> > > > {
> > > > // .....
> > > > }
> > > >
> > > > The following article will provide a good overview.
> > > >
> > >
> >
>

http://msdn.microsoft.com/library/en...asp?frame=true
> > > >
> > > >
> > > > Regards,
> > > > Aravind C
> > > >
> > > >
> > > > "Lasse Edsvik" <la***@nospam.c om> wrote in message
> > > > news:#H******** ******@TK2MSFTN GP09.phx.gbl...
> > > > > Hello
> > > > >
> > > > > I'm trying to build a simple COM+ app in vs.net using C# and i cant
> > > > register
> > > > > it in component manager.....
> > > > >
> > > > > what more is needed than this:
> > > > >
> > > > > using System;
> > > > >
> > > > > using System.Enterpri seServices;
> > > > >
> > > > > namespace COMTest
> > > > >
> > > > > {
> > > > >
> > > > > /// <summary>
> > > > >
> > > > > /// Summary description for Class1.
> > > > >
> > > > > /// </summary>
> > > > >
> > > > > public class Class1
> > > > >
> > > > > {
> > > > >
> > > > > public Class1() {}
> > > > >
> > > > > public string WriteShit()
> > > > >
> > > > > {
> > > > >
> > > > > return "shite";
> > > > >
> > > > > }
> > > > >
> > > > > }
> > > > >
> > > > > }
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #16
"Lasse Edsvik" <la***@nospam.c om> wrote:
Sam,

in this example i dont have to use transactions... .. so i'll skip that and
learn that some other time then...

how i make this a "regular" COM app?


Serviced Components are totally different beasts !!!

But here is the process for creating a .NET component and
exporting it to COM:
1.) Create a Visual C# Project: Class Library

Name the project COMApp

Rename Class1.cs to CSharpClass.cs

2.) Create StrongName key

Open a "Visual Studio .NET command Prompt window"
Navigate to the project directory (e.g. COMApp)
then on the commandline

sn -k COMApp.key

3.) Im VS.NET go into the AssemblyInfo.cs and modify the following line:

[assembly: AssemblyKeyFile (@"..\..\COMApp .key")]

4.) In CSharp.cs enter the following code:
using System;
using System.Runtime. InteropServices ;

namespace COMApp {
public class CSharpClass {

[ComVisible(true )]
public string MyMethod(){
return "This string comes from CSharpClass";
}
}
}
Build the Class Library

5) Go Back to the "Visual Studio .NET command Prompt window"
Navigate to the project's output directory (e.g. ..COMApp\bin\De bug)
then on the commandline

regasm /nologo /codebase COMApp.dll

6.) Test the component. Here I'm using windows script host. Create the test file COMTestApp.vbs:
' COMAppTest.vbs
set cls = CreateObject( "COMApp.CSharpC lass" )
MsgBox cls.MyMethod()
Then run it in your command line window with:
wscript COMAppTest.vbs

You should see a "VBScript" message box with "This string comes from CSharpClass".

Nov 15 '05 #17
works in a .vbs file, but why cant i use it in a .asp page?

<%
set cls = CreateObject("s hit.shitclass")
a=cls.WriteShit ()
response.write( a)
%>
i get error on the createobject line........ and it doesnt matter if its
server.createob ject......

/Lasse

"UAError" <nu**@null.null > wrote in message
news:d8******** *************** *********@4ax.c om...
"Lasse Edsvik" <la***@nospam.c om> wrote:
Sam,

in this example i dont have to use transactions... .. so i'll skip that andlearn that some other time then...

how i make this a "regular" COM app?
Serviced Components are totally different beasts !!!

But here is the process for creating a .NET component and
exporting it to COM:
1.) Create a Visual C# Project: Class Library

Name the project COMApp

Rename Class1.cs to CSharpClass.cs

2.) Create StrongName key

Open a "Visual Studio .NET command Prompt window"
Navigate to the project directory (e.g. COMApp)
then on the commandline

sn -k COMApp.key

3.) Im VS.NET go into the AssemblyInfo.cs and modify the following line:

[assembly: AssemblyKeyFile (@"..\..\COMApp .key")]

4.) In CSharp.cs enter the following code:
using System;
using System.Runtime. InteropServices ;

namespace COMApp {
public class CSharpClass {

[ComVisible(true )]
public string MyMethod(){
return "This string comes from CSharpClass";
}
}
}
Build the Class Library

5) Go Back to the "Visual Studio .NET command Prompt window"
Navigate to the project's output directory (e.g. ..COMApp\bin\De bug)
then on the commandline

regasm /nologo /codebase COMApp.dll

6.) Test the component. Here I'm using windows script host. Create the

test file COMTestApp.vbs:

' COMAppTest.vbs
set cls = CreateObject( "COMApp.CSharpC lass" )
MsgBox cls.MyMethod()
Then run it in your command line window with:
wscript COMAppTest.vbs

You should see a "VBScript" message box with "This string comes from CSharpClass".

Nov 15 '05 #18
and when i register it in component manager the method wont show
anywhere......

/Lasse
"Lasse Edsvik" <la***@nospam.c om> wrote in message
news:OH******** ******@TK2MSFTN GP11.phx.gbl...
works in a .vbs file, but why cant i use it in a .asp page?

<%
set cls = CreateObject("s hit.shitclass")
a=cls.WriteShit ()
response.write( a)
%>
i get error on the createobject line........ and it doesnt matter if its
server.createob ject......

/Lasse

"UAError" <nu**@null.null > wrote in message
news:d8******** *************** *********@4ax.c om...
"Lasse Edsvik" <la***@nospam.c om> wrote:
Sam,

in this example i dont have to use transactions... .. so i'll skip that andlearn that some other time then...

how i make this a "regular" COM app?


Serviced Components are totally different beasts !!!

But here is the process for creating a .NET component and
exporting it to COM:
1.) Create a Visual C# Project: Class Library

Name the project COMApp

Rename Class1.cs to CSharpClass.cs

2.) Create StrongName key

Open a "Visual Studio .NET command Prompt window"
Navigate to the project directory (e.g. COMApp)
then on the commandline

sn -k COMApp.key

3.) Im VS.NET go into the AssemblyInfo.cs and modify the following line:

[assembly: AssemblyKeyFile (@"..\..\COMApp .key")]

4.) In CSharp.cs enter the following code:
using System;
using System.Runtime. InteropServices ;

namespace COMApp {
public class CSharpClass {

[ComVisible(true )]
public string MyMethod(){
return "This string comes from CSharpClass";
}
}
}
Build the Class Library

5) Go Back to the "Visual Studio .NET command Prompt window"
Navigate to the project's output directory (e.g. ..COMApp\bin\De bug)
then on the commandline

regasm /nologo /codebase COMApp.dll

6.) Test the component. Here I'm using windows script host. Create the

test file COMTestApp.vbs:


' COMAppTest.vbs
set cls = CreateObject( "COMApp.CSharpC lass" )
MsgBox cls.MyMethod()
Then run it in your command line window with:
wscript COMAppTest.vbs

You should see a "VBScript" message box with "This string comes from

CSharpClass".


Nov 15 '05 #19
To have a full understanding of how to do "regular" COM Interop, please read
my MSDN piece
http://msdn.microsoft.com/library/de...tml/bridge.asp

I am told that many people have found it very useful to understand all the
questions you are asking. Please read and then I'll be happy to answer any
remaining questions.
--------------------------------------------------------------
Sam Gentile [C#/.NET MVP]
..NET Blog http://samgentile.com/blog/
MSDN Column:
http://msdn.microsoft.com/library/de...tml/bridge.asp
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
---------------------------------------------------------------
"Lasse Edsvik" <la***@nospam.c om> wrote in message
news:%2******** *******@TK2MSFT NGP11.phx.gbl.. .
Sam,

in this example i dont have to use transactions... .. so i'll skip that and
learn that some other time then...

how i make this a "regular" COM app?
using System;

using System.Enterpri seServices;

[assembly: ApplicationName ("COMTest")]

[assembly: AssemblyKeyFile ("COMTest.sn k")]

namespace COMTest

{

public class Class1 : ServicedCompone nt

{

public Class1() {}

public string WriteShit()

{

return "shite";

}

}

}

"Sam Gentile [MVP]" <sa*@nomail.com > wrote in message
news:eF******** ******@TK2MSFTN GP09.phx.gbl...
trying to build a simple COM app that i'll use in regular ASP-pages Why are using ES/COM+ then? Do you have distributed transactions or other
needs that require COM+/ES services? If not, all you need is COM Interop

--
Sam Gentile [C#/.NET MVP]
.NET Blog http://samgentile.com/blog/
MSDN Column:

http://msdn.microsoft.com/library/de...tml/bridge.asp
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no

rights.
"Lasse Edsvik" <la***@nospam.c om> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Sam,

trying to build a simple COM app that i'll use in regular ASP-pages

/Lasse
"Sam Gentile [MVP]" <sa*@nomail.com > wrote in message
news:en******** ******@TK2MSFTN GP10.phx.gbl...
> Are you creating a COM+ server or library component? It makes a
difference.
> This is controlled by:
> [assembly: ApplicationActi vation(Activati onOption.Server )]
>
> Or
>
> [assembly: ApplicationActi vation(Activati onOption.Librar y)]
>
>
>
> While convenient, the lazy registration in step 9 does not work in many > scenarios as it requires Admin rights as well as other issues. So really the
> right way. So the correct way that will work in all scenarios is replace > step 9 by:
>
> 9) gacutil.exe - i COMtest.dll (this puts it in the GAC)
>
> 10) regsvcs.exe COMtest.sll (this makes it a configured
> coomponent in the COM+ catalog)
>
>
> --
> Sam Gentile [C#/.NET MVP]
> .NET Blog http://samgentile.com/blog/
> MSDN Column:
>

http://msdn.microsoft.com/library/de...tml/bridge.asp
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> "Lasse Edsvik" <la***@nospam.c om> wrote in message
> news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
> > Sam,
> >
> > hmm, i fail at step 9 eventhough i've created COMTest.snk, should it be
in
> > AssemblyInfo.cs ?
> >
> >
> > looks like this now:
> >
> > using System;
> >
> > using System.Enterpri seServices;
> >
> > [assembly: ApplicationName ("COMTest")]
> >
> > [assembly: AssemblyKeyFile ("COMTest.sn k")]
> >
> > namespace COMTest
> >
> > {
> >
> > public class Class1 : ServicedCompone nt
> >
> > {
> >
> > public Class1() {}
> >
> > public string WriteShit()
> >
> > {
> >
> > return "shite";
> >
> > }
> >
> >
> >
> >
> >
> >
> >
> > in Assemblyinfo.cs its:
> >
> >
> >
> >
> >
> > [assembly: AssemblyDelaySi gn(false)]
> >
> > [assembly: AssemblyKeyFile ("")]
> >
> > [assembly: AssemblyKeyName ("")]
> >
> >
> >
> >
> >
> > "Sam Gentile [MVP]" <sa*@nomail.com > wrote in message
> > news:uC******** *****@TK2MSFTNG P12.phx.gbl...
> > > You are missing a few steps, basically the assembly attributes
so
that
> > "Lazy
> > > registration" can occur in the COM+ catalog. Without that step
you have
> to
> > > do an explicit regsvcs.exe. Here are the steps from a blog post of mine:
> > > 1.. Create a DLL project
> > > 2.. Add a Reference to System.Enterpri seServices
> > > 3.. Add a using declaration: using System.Enterpri seServices;
> > > 4.. Inherit your classes from ServicedCompone nt (i.e. public

Widget
:
> > > ServicedCompone nt)
> > > 5.. Stick an [assembly: ApplicationName ("ComPlusApp ")] at the

top
so
> > that
> > > "COMPlusApp " or whatever is the name of the application when it is > > > registered in the COM+ catalog.
> > > 6.. Stick a strong name attribute at the top of the file

[assembly:
> > > AssemblyKeyFile ("ComPlus.sn k")]
> > > 7.. Go to the command line and generate a Strong Name sn -k
> ComPlus.snk
> > > 8.. If you have some method that performs a transaction, put
> > > [AutoComplete] on top of it
> > > 9.. Build - This will lazy register the COM+ app in the COM+

catalog
> (In
> > > some circumstances I will go into detail in a future article, you may
> have
> > > to do use regsvcs.exe ComPlusApp.dll)
> > > 10.. Create a client that references System.Enterpri seServices

and > calls
> > > your COM+ method(s)
> > > 11.. Run it
> > > See http://samgentile.com/blog/archive/2003/06/25/7844.aspx
> > >
> > > ----
> > > Sam Gentile [C#/.NET MVP]
> > > .NET Blog http://samgentile.com/blog/
> > > MSDN Column:
> > >
> >
>

http://msdn.microsoft.com/library/de...tml/bridge.asp > > > Please reply only to the newsgroup so that others can benefit.
> > > This posting is provided "AS IS" with no warranties, and confers no > > rights.
> > > ------
> > >
> > >
> > > "Lasse Edsvik" <la***@nospam.c om> wrote in message
> > > news:uS******** ********@TK2MSF TNGP09.phx.gbl. ..
> > > > Aravind,
> > > >
> > > > i still get "One or more files do not contain components or type > > > libraries.
> > > > These files cannot be installed" :(
> > > >
> > > > I assume that assembly stuff is just for transactions?
> > > >
> > > > cant find a simple hello world app om msdn, its a djungle...... > > > >
> > > > /Lasse
> > > >
> > > >
> > > > "Aravind C" <ar***********@ nospam.hotmail. com> wrote in message > > > > news:OD******** ******@TK2MSFTN GP12.phx.gbl...
> > > > > HI Lasse,
> > > > >
> > > > > You must also derive your class from ServicedCompone nt.
> > > > >
> > > > > public class Class1 : ServicedCompone nt
> > > > > {
> > > > > // .....
> > > > > }
> > > > >
> > > > > The following article will provide a good overview.
> > > > >
> > > >
> > >
> >
>

http://msdn.microsoft.com/library/en...asp?frame=true
> > > > >
> > > > >
> > > > > Regards,
> > > > > Aravind C
> > > > >
> > > > >
> > > > > "Lasse Edsvik" <la***@nospam.c om> wrote in message
> > > > > news:#H******** ******@TK2MSFTN GP09.phx.gbl...
> > > > > > Hello
> > > > > >
> > > > > > I'm trying to build a simple COM+ app in vs.net using C#
and i > cant
> > > > > register
> > > > > > it in component manager.....
> > > > > >
> > > > > > what more is needed than this:
> > > > > >
> > > > > > using System;
> > > > > >
> > > > > > using System.Enterpri seServices;
> > > > > >
> > > > > > namespace COMTest
> > > > > >
> > > > > > {
> > > > > >
> > > > > > /// <summary>
> > > > > >
> > > > > > /// Summary description for Class1.
> > > > > >
> > > > > > /// </summary>
> > > > > >
> > > > > > public class Class1
> > > > > >
> > > > > > {
> > > > > >
> > > > > > public Class1() {}
> > > > > >
> > > > > > public string WriteShit()
> > > > > >
> > > > > > {
> > > > > >
> > > > > > return "shite";
> > > > > >
> > > > > > }
> > > > > >
> > > > > > }
> > > > > >
> > > > > > }
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 15 '05 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

303
17886
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b. Yahoo store was originally written in Lisp. c. Emacs The issues with these will probably come up, so I might as well mention them myself (which will also make this a more balanced
5
3992
by: Brian Hlubocky | last post by:
I'm have a fairly simple (in terms of COM) python program that pulls info from an Access database and creates Outlook contacts from that information. It uses wxPython for gui and works without problems. I want to be able to distribute this program using py2exe, but I am having some problems. I am using a simple setup.py like in the documentation for the py2exe tool and everything compiles ok, except that when I run the exe, I get an...
0
1521
by: Sean McKaharay | last post by:
I am using the code below and I am getting this error: "Insufficient state to deserialize the object. More information is needed." Has anyone seen this? It is working with other dll's but not on a certain one. Can some help? private void LoadAssembly(string DllLocationDirectory, string applicationName, bool shadowCopyFiles, string friendlyName, string dllName,
11
2612
by: Micha | last post by:
Hello there, I think I've run into some classic c++ pitfall and maybe some of you guys can help me out. For my project I will need to use matrices and vectors and so I decided to implement them by myself. I know there are already tons of vector and matrix implementations, but I wanted to have one taylored for my needs and without debugging someones else code. Also is's become somewhat personal meanwhile ;-).
0
1586
by: athens.gr. | last post by:
VIRTUALIZATION ENGINE CONSOLE A RUNTIME 1.1 - IBM (3 CDs), WEBSPHERE BUSINESS INTEGRATION CONNECT ADVANCED v4.2.2 - IBM, other 16,000 more CDs, (free donge)! No time limitation! 03/Sep/2004 B12 VIRTUALIZATION ENGINE CONSOLE A RUNTIME 1.1 - IBM (3 CDs) B13 WEBSPHERE BUSINESS INTEGRATION CONNECT ADVANCED v4.2.2 - IBM
4
3297
by: Koen | last post by:
Hi all, At work I created a database which is really helpful. The database is used by approx 15 users. Everything worked great, until I added some 'scoreboard' forms and reports. I get the "Cannot open any more databases" error. The 'scoreboard' form show a matrix of 6 columns, 7 rows. Each cell is calculated separate by (what I call complex) queries.
4
3033
by: Steve Jorgensen | last post by:
I'm restarting this thread with a different focus. The project I'm working on now id coming along and will be made to work, and it's too late to start over with a new strategy. Still, I'm not coming to a firm conclusion over whether it was the better approach, and wonder if I should do it differently the next time I'm faced with a similar issue. I needed an app to automatically import from spreadsheets with a semi-dynamic structure,...
38
2317
by: Mark Dickinson | last post by:
I get the following behaviour on Python 2.5 (OS X 10.4.8 on PowerPC, in case it's relevant.) (0.0, 0.0) (-0.0, -0.0) I would have expected y to be -0.0 in the first case, and 0.0 in the second. Should the above be considered a bug, or is Python not expected to honour signs of zeros? I'm working in a situation involving complex arithmetic where branch cuts, and hence signed
82
3757
by: Bill David | last post by:
SUBJECT: How to make this program more efficient? In my program, a thread will check update from server periodically and generate a stl::map for other part of this program to read data from. Let's name the update method as doUpdate and stl::map read methods as getData and copyData. Since stl::map is not thread-safe, we should do synchronization by ourselves. A usable solution is to create a boost::mutex::scoped_lock object in all above...
0
9932
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9777
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11109
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10833
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10405
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9558
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5782
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5980
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3227
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.