Re: Calling a COM component via C#(ASP .net)

From: Badrinath Mohan (bmohan_at_NOSPAMuncc.edu)
Date: 11/12/03


Date: Wed, 12 Nov 2003 11:33:41 -0600

Unfortunately i was calling it from a web service and aspcompat was not
recognized there..
Fortunately
But ur idea helped me to study more on that and I got this idea of approach

Thread newThread =
new Thread(new ThreadStart(ThreadMethod));
newThread.ApartmentState = ApartmentState.STA;
newThread.Start ();
and in my Thread method i did the functionality of calling the COM
component.

It works like a charm...

thanks...
Badri

"Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com> wrote in
message news:O6xF$nLqDHA.1408@TK2MSFTNGP11.phx.gbl...
> you will need to add the directive "aspcompat=true" to the page directive
to
> force the component to use the single threaded apartment model.
>
> regards
>
> --
>
>
> -----------
> Got TidBits?
> Get it here: www.networkip.net/tidbits
> "Badrinath Mohan" <bmohan@NOSPAMuncc.edu> wrote in message
> news:Op13yQKqDHA.708@TK2MSFTNGP10.phx.gbl...
> > Hi All
> > I am accessing a COM component using C#. When i access it through the
> > standalone c# application it works fine.But when i call it using ASP
.net
> > application its not working .
> > For example
> >
> > This is my COM function..
> > Myfunction(int *PNINPUT ,int nsize,int *PNOUTPUT) is the com function
in
> > the DLL.
> >
> >
> > I add the reference in my c# application
> >
> > I call it in the C# application as follows
> > int [] pninput=new int[32];
> > //fill values in pninput
> >
> > int [] pnoutput=new int[32];
> > Myfunction(ref pnInput,32,ref pnoutput);
> >
> > I step into the dll and look at the function.
> > If its a standalone c# application it works fine .
> > with PNINPUT having all the values.
> >
> > But when the c# client is a ASP .net the PNINPUT has only the first
value
> > rest of the values are all junk. That is the input variable is not
passed
> > onto the function at all,....
> >
> > Could anyone please help me to solve this.
> >
> > thanks and expecting ur reply
> > kandukondein
> >
> >
>
>



Relevant Pages

  • Re: The Lib debate
    ... >>Calling Functions in a DLL is a comletely different thing. ... For shared object libraries you have to call ... I have been told that zip comes with a Lib only. ...
    (alt.lang.asm)
  • Re: using the CWegPage.dll
    ... It is using the WINAPI (_stdcall) calling ... > The source code for the DLL is on that page and is in this link to the zip ... >> change the calling convention to that which VB can handle. ... >>> The goal is to put an internet explorer web browswer on my form. ...
    (microsoft.public.vc.language)
  • Re: using the CWegPage.dll
    ... It is using the WINAPI (_stdcall) calling ... > The source code for the DLL is on that page and is in this link to the zip ... >> change the calling convention to that which VB can handle. ... >>> The goal is to put an internet explorer web browswer on my form. ...
    (microsoft.public.vb.winapi)
  • Re: moving data from one place to another in a text file
    ... """Calling DLL's under Windows ... the Pascal convention. ... used by a DLL just try one. ... that we're calling 'routine1' which expects a number as its first ...
    (comp.lang.cobol)
  • Re: How to debug load-time DLL exception?
    ... It is safe to call other functions in Kernel32.dll, ... Calling imported functions other than those located in Kernel32.dll may ... User, Shell, and COM functions can cause access violation errors, because ... here is the better stack trace:> ...
    (microsoft.public.win32.programmer.kernel)