COM+ role and enable the role for your component. It's best to use
<scollpov@hotmail.com> wrote:
>This is my COM+'s code:
>
>using System;
>using System.Text;
>using System.IO;
>using System.Reflection;
>using System.EnterpriseServices;
>using System.Runtime.InteropServices;
>
>namespace Sgm.Interface
>{
> public interface ISampleSgm2
> {
> string Sistema {set;}
> void Write();
> }
>
> [ProgIdAttribute("SampleSgm2")]
> public class SampleSgm2 : ServicedComponent,
> ISampleSgm2
> {
> public string _sistema = "";
>
> public SampleSgm2(){}
>
> public string Sistema
> {
> set {_sistema=value;}
> get {return _sistema;}
> }
>
> public void Write()
> {
> String reg="";
> FileStream fs = new
> FileStream
> ("c:\\temp\\SampleSgm.log",
> FileMode.Append);
>
> DateTime dt = DateTime.Now;
>
> reg=_sistema + " "+ dt.ToShortDateString()+"
>"+dt.ToShortTimeString()+"\n";
>
> byte[] text = ASCIIEncoding.ASCII.GetBytes(reg);
>
> fs.Write(text, 0,
> text.Length);
>
> fs.Close();
>
> }
> }
>}
>
>I follow the next steps:
>
>1.- sn -k XXXXXX.snk
>2.- compile (VS-2002)
>3.- regasm /tlb:XXXXX.tlb /codebase XXXXXX.dll
>4.- gacutil -i XXXXXX.dll
>
>and next ..
>
>I create manually a application in Serviced Components (Server's
>application)and I import this registered COM.
>
>Finally I generated a proxy for the client.
>
>Install de proxy in the client.
>
>And I try this code in client, VB for application in excel
>
> Dim obj As Object
>
> Set obj=CreateObject("SampleSgm2")
>
>.. and I recive an exception ('242'Object required or '70'Not Allowed)
>it depends of the proxy's configuration.
>
>If someone have an idea that can helps me, I'll be interested to read
>it.
>
>Thanks.
>
>
>
>
>
>
>
>*** Sent via Developersdex
http://www.developersdex.com ***
>Don't just participate in USENET...get rewarded for it!