writing C# assambly for COM+ and use it by asp/vb/asp.net 
Author Message
 writing C# assambly for COM+ and use it by asp/vb/asp.net

Im trying to write a .Net component in C# and use it from classic asp and
asp.net.

i wrote following code:
  //test_server.cs
  using System;
  using System.Reflection;
  using System.EnterpriseServices;
  [assembly: ApplicationName("test")]
  [assembly: AssemblyKeyFileAttribute("test.snk")]
  namespace test
  {
      [Transaction(TransactionOption.Required)]
      public class ServerSettings : ServicedComponent
      {
             [AutoComplete]
             public string ApplicationName()
             {
                   return "Test";
             }
      }
  }

and:

  //test_client.cs
  using System;
  using test;

  namespace testClient
  {
    class Client
    {
        public static void Main()
        {
               ServerSettings x = new ServerSettings();
               Console.WriteLine(x.ApplicationName());
               Console.ReadLine();
          }
      }
  }

after compiling the server with:

  csc.exe /target:library /out:test_server.dll
/r:System.EnterpriseServices.dll test_server.cs

and the client:

  csc.exe test_client.cs

and executing test_client.exe a tlb is created and test_server has registerd
to COM+ and i
can call the server from VBScript:

  Set x = Wscript.CreateObject("test.ServerSettings")
  Wscript.Echo x.ApplicationName()

works fine, but when i try to call the test_server from
aspx (...yes the test.server.dll is in the bin directory..) followig
exception is thrown:

  Referenced class 'test.ServerSettings' has base class or interface
  'System.EnterpriseServices.ServicedComponent' defined in an assembly
  that is not referenced. You must add a reference to assembly
'System.EnterpriseServices'.

but i got 'System.EnterpriseServices' in the 'using' and compiled it wit
/r:'System.EnterpriseServices.dll whats wrong ????

PLEASE HELP

lenny



Sun, 19 Sep 2004 06:45:43 GMT  
 writing C# assambly for COM+ and use it by asp/vb/asp.net
You have to reference  "System.EnterpriseServices.ServicedComponent." in the
client too

Atleast thats what i did for WinForm apps.

Regards
Khozema


Quote:
> Im trying to write a .Net component in c# and use it from classic asp and
> asp.net.

> i wrote following code:
>   file://test_server.cs
>   using System;
>   using System.Reflection;
>   using System.EnterpriseServices;
>   [assembly: ApplicationName("test")]
>   [assembly: AssemblyKeyFileAttribute("test.snk")]
>   namespace test
>   {
>       [Transaction(TransactionOption.Required)]
>       public class ServerSettings : ServicedComponent
>       {
>              [AutoComplete]
>              public string ApplicationName()
>              {
>                    return "Test";
>              }
>       }
>   }

> and:

>   file://test_client.cs
>   using System;
>   using test;

>   namespace testClient
>   {
>     class Client
>     {
>         public static void Main()
>         {
>                ServerSettings x = new ServerSettings();
>                Console.WriteLine(x.ApplicationName());
>                Console.ReadLine();
>           }
>       }
>   }

> after compiling the server with:

>   csc.exe /target:library /out:test_server.dll
> /r:System.EnterpriseServices.dll test_server.cs

> and the client:

>   csc.exe test_client.cs

> and executing test_client.exe a tlb is created and test_server has
registerd
> to COM+ and i
> can call the server from vbscript:

>   Set x = Wscript.CreateObject("test.ServerSettings")
>   Wscript.Echo x.ApplicationName()

> works fine, but when i try to call the test_server from
> aspx (...yes the test.server.dll is in the bin directory..) followig
> exception is thrown:

>   Referenced class 'test.ServerSettings' has base class or interface
>   'System.EnterpriseServices.ServicedComponent' defined in an assembly
>   that is not referenced. You must add a reference to assembly
> 'System.EnterpriseServices'.

> but i got 'System.EnterpriseServices' in the 'using' and compiled it wit
> /r:'System.EnterpriseServices.dll whats wrong ????

> PLEASE HELP

> lenny



Sun, 19 Sep 2004 18:40:29 GMT  
 writing C# assambly for COM+ and use it by asp/vb/asp.net
Please don't multipost.
See: 'microsoft.public.dotnet.framework.interop' same topic.

Willy.

Quote:

> Im trying to write a .Net component in c# and use it from classic asp and
> asp.net.

> i wrote following code:
>   //test_server.cs
>   using System;
>   using System.Reflection;
>   using System.EnterpriseServices;
>   [assembly: ApplicationName("test")]
>   [assembly: AssemblyKeyFileAttribute("test.snk")]
>   namespace test
>   {
>       [Transaction(TransactionOption.Required)]
>       public class ServerSettings : ServicedComponent
>       {
>              [AutoComplete]
>              public string ApplicationName()
>              {
>                    return "Test";
>              }
>       }
>   }

> and:

>   //test_client.cs
>   using System;
>   using test;

>   namespace testClient
>   {
>     class Client
>     {
>         public static void Main()
>         {
>                ServerSettings x = new ServerSettings();
>                Console.WriteLine(x.ApplicationName());
>                Console.ReadLine();
>           }
>       }
>   }

> after compiling the server with:

>   csc.exe /target:library /out:test_server.dll
> /r:System.EnterpriseServices.dll test_server.cs

> and the client:

>   csc.exe test_client.cs

> and executing test_client.exe a tlb is created and test_server has registerd
> to COM+ and i
> can call the server from vbscript:

>   Set x = Wscript.CreateObject("test.ServerSettings")
>   Wscript.Echo x.ApplicationName()

> works fine, but when i try to call the test_server from
> aspx (...yes the test.server.dll is in the bin directory..) followig
> exception is thrown:

>   Referenced class 'test.ServerSettings' has base class or interface
>   'System.EnterpriseServices.ServicedComponent' defined in an assembly
>   that is not referenced. You must add a reference to assembly
> 'System.EnterpriseServices'.

> but i got 'System.EnterpriseServices' in the 'using' and compiled it wit
> /r:'System.EnterpriseServices.dll whats wrong ????

> PLEASE HELP

> lenny



Sun, 19 Sep 2004 22:09:32 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to call VB.net and ASP.net programs in MFC?(or,asp call vc)

2. Accessing ASP(not ASP.Net) built-in objects with C#

3. (COM+) How can I call a COM+ interface from C#/ASP.NET

4. (COM+) How to call from C#/ASP.NET

5. Cobranding Passport-login-page using ASP .NET and C#

6. Can not create web application (ASP.NET using C#)

7. Using Crystal Report in ASP.net with C#

8. ASP.NET using C# - Delete all files with same extension with one call

9. ASP.NET question, using C#

10. connect to SQL with ASP.net using C#

11. C# ASP.NET Forms - Client Side Validation using Custom Validator Control

12. Uploading and retrieving picture from AD using C#, ASP .NET and System.DirectoryServices

 

 
Powered by phpBB® Forum Software