C++ ActiveX, Com Servers
Discussion
Hi,
I am looking for a pointer on how to do something.
In VB if I create an ActiveX EXE I can call this from another application such as C++ or a VB app I create. Dependang in the instancing of the ActiveX depends on what happens. In this case I want a SingleUse Exe, i.e each time I call the object it creates / launches a new exe (with my class contained in it.) This creates an out of process object in exe form. I am happy with all of this in vb.
I currently have a C++ COM object in DLL form, that I need to convert to an Out of process EXE. or I am quite happy to create a wrapper object that is the exe. But I cannot find any thing on out of process exe's relating to c++ (VC6 prefered, could be VS2005). I dont even know what it is called in C++, I thougt it was a COM server but these appear to be in process.
I think I have a workaround but I would prefer to learn how it should be done. I am pretty sure I could create the activex exe in vb as a wrapper around my existing C++ dll, but it just seems a little messy after having spent the time to write the componect in C++ in the first place.
Any thoughts.
Thanks
I am looking for a pointer on how to do something.
In VB if I create an ActiveX EXE I can call this from another application such as C++ or a VB app I create. Dependang in the instancing of the ActiveX depends on what happens. In this case I want a SingleUse Exe, i.e each time I call the object it creates / launches a new exe (with my class contained in it.) This creates an out of process object in exe form. I am happy with all of this in vb.
I currently have a C++ COM object in DLL form, that I need to convert to an Out of process EXE. or I am quite happy to create a wrapper object that is the exe. But I cannot find any thing on out of process exe's relating to c++ (VC6 prefered, could be VS2005). I dont even know what it is called in C++, I thougt it was a COM server but these appear to be in process.
I think I have a workaround but I would prefer to learn how it should be done. I am pretty sure I could create the activex exe in vb as a wrapper around my existing C++ dll, but it just seems a little messy after having spent the time to write the componect in C++ in the first place.
Any thoughts.
Thanks
What is the context for the call that you want to make into the ActiveX object.
I'm not sure that there are an awful lot of reasons to implement an out of process COM object? I don't know if I can be a great deal of help TBH, but I do know how to create an in process object, and I can visualise what you are trying to do, just not from where.
Maybe there is a different way to approach the problem? Without knowing where you want to make the call from, I cannot predict alternatives.
I'm not sure that there are an awful lot of reasons to implement an out of process COM object? I don't know if I can be a great deal of help TBH, but I do know how to create an in process object, and I can visualise what you are trying to do, just not from where.
Maybe there is a different way to approach the problem? Without knowing where you want to make the call from, I cannot predict alternatives.
dilbert said:
What is the context for the call that you want to make into the ActiveX object.
I'm not sure that there are an awful lot of reasons to implement an out of process COM object? I don't know if I can be a great deal of help TBH, but I do know how to create an in process object, and I can visualise what you are trying to do, just not from where.
Maybe there is a different way to approach the problem? Without knowing where you want to make the call from, I cannot predict alternatives.
As I said I already have an inprocess dll that works fine. I can call this from test vb and c++ applications. In the production enviroment it is being used to perform some complicated business logic, so the com object is called from a clasic asp page. All of which works fine. There is a point of code in the dll that does an http post to another web server. (I have no control over the other server and I MUST follow there methods). It is at this stage I am having problems. It would appear that there is a limitation in IIS (Internet Information Services) that you can only post 100k of data at a time. I need to post more than 100k of data. It could be 150 - 500 (I very much doubt it would be more but is possible). Microsoft suggest sending it in smaller chunks and restoring it at the other end but as I say I do not have control of this. Bearing in mind I can post the data sucessfully during my test apps(vb or c++) I believe it is limited to the scope of the running process. In this case IIS. So I was hoping by making it out of process it would run in its own process space and sort the problem.I'm not sure that there are an awful lot of reasons to implement an out of process COM object? I don't know if I can be a great deal of help TBH, but I do know how to create an in process object, and I can visualise what you are trying to do, just not from where.
Maybe there is a different way to approach the problem? Without knowing where you want to make the call from, I cannot predict alternatives.
If there is a fix to the posting more than 100k from IIS then that would also sort the issue. There is no great speed issues here, so to be honest the extra overhead / potential speed drop is not really an issue but send the correct data is.

Thanks
I do not have the exact erro to hand but I think this is what the probem was. If you look at this you will see you need to control both server and client. I only have access to the client. Arghhhhhhh
http://support.microsoft.com/default.aspx?scid=kb;...
http://support.microsoft.com/default.aspx?scid=kb;...
Edited by bholleran on Monday 8th October 19:47
GnuBee said:
So which server is generating the error? Your server or the target of your embedded post command?
I think it is being generated from the embedded server. Although it should not be using any of its features any way. I have just checked the code and I am sending the post using sockets. i.e. open a TCP socket on port 80 and construct the message manually. Hence the reason it works in all the other cases.GnuBee said:
So the situation is that your code attempts a post to another server and that server is throwing the exception. Unfortunately the other server is in effect a "sealed box" over which you have no authority.
So does the other server allow you to submit the data in chunks?
No it does not allow me to transmit in chunks.So does the other server allow you to submit the data in chunks?
bholleran said:
GnuBee said:
So which server is generating the error? Your server or the target of your embedded post command?
I think it is being generated from the embedded server. Although it should not be using any of its features any way. I have just checked the code and I am sending the post using sockets. i.e. open a TCP socket on port 80 and construct the message manually. Hence the reason it works in all the other cases.The method of posting the data is working ok, it is only the limit on my server that is the problem. If I make the process sending the data a different process from the IIS process it all works ok.
Edited by bholleran on Tuesday 9th October 10:35
GnuBee said:
Thanks for the link, no I had not seen that. That is exactly what I am trying to do.At least I now know I will need to configure IIS.
"When you use Server.CreateObject in an ASP page to start an out-of-process component, and IIS 5.0 has not been configured to allow out-of-process components, it will return the following error: "
In this case the load of the server is not an issue and this would still be my prefered route.
Sorry I didn't get back yesterday. I actually found that page yesterday but didn't post a link because I wasn't sure if it applied to you. In fact it was why I was asking about the context of your call.
I don't know much about ASP, but I am pretty sure that you can't open a socket, format a packet and fire it off in an expicit way. I'm assuming that is what your COM object is for.
The thing to bear in mind here is that the performance that MS is on about with in, and out, of process servers is attributable to the way in which the binary image is used. So for example if you 50,000 people all using your page, that call the COM object, then you'll have 50,000 instances of of the code in memory at once if you use an out of process server.
With the in process server then the code segement of the app will be resident in memory once, and the, data segment will be replicated on a per user basis. It just saves all the extra disk activity of repeatedly loading the server.
O.K. So look at it a different way. Everybody used to write executables, until COM came along and allowed you to essentially implement dynamic, dynamic linking. The DLL already allowed the programmer to minimize memory utilization of code, and COM simplified the process of versioning DLL's in a dynamic way.
Recognizing COM as the versioning scheme that it is, it becomes clear that it is the DLL part of the deal which allows you to choose which process you wish to execute the code from.
The thing here is that a DLL does not make any distinction about the code you run. On it's own it's not a managed environment, you just call into whatever modules you can see, and want to use. I can't see why it should make a difference to opening a socket irrespective of you calling it from an IIS process, or a dedicated process.
I don't dispute that you are having problems though! It's always the way. I would have said that IIS is doing something to it's instance of the Winsock module, and that you are inherently calling through that instance when you use an in process server. I'd say that you have to figure out what it's doing and get it changed such that you can send the data in the way you need to. I can see the rationale behind the out of process server. I think it might solve your problem, but I have a feeling that you are just going to find different problems.
I appreciate that you don't need the performance, but if the performance is noticably low, then at the very least it's offering an easy denial of service attack to someone!
I doubt I can help you more than that, and even then I'm not sure my words help, but I do hope you find a way through. Battling MS products..... sadly it's the way of the world. I just can't count the number of times I've come across these sorts of hurdles.......
You're using this fantastic product, you just want it to do this extra thing. Ahh BUT. When you ask, does anyone know anything? Sympathies.
I don't know much about ASP, but I am pretty sure that you can't open a socket, format a packet and fire it off in an expicit way. I'm assuming that is what your COM object is for.
The thing to bear in mind here is that the performance that MS is on about with in, and out, of process servers is attributable to the way in which the binary image is used. So for example if you 50,000 people all using your page, that call the COM object, then you'll have 50,000 instances of of the code in memory at once if you use an out of process server.
With the in process server then the code segement of the app will be resident in memory once, and the, data segment will be replicated on a per user basis. It just saves all the extra disk activity of repeatedly loading the server.
O.K. So look at it a different way. Everybody used to write executables, until COM came along and allowed you to essentially implement dynamic, dynamic linking. The DLL already allowed the programmer to minimize memory utilization of code, and COM simplified the process of versioning DLL's in a dynamic way.
Recognizing COM as the versioning scheme that it is, it becomes clear that it is the DLL part of the deal which allows you to choose which process you wish to execute the code from.
The thing here is that a DLL does not make any distinction about the code you run. On it's own it's not a managed environment, you just call into whatever modules you can see, and want to use. I can't see why it should make a difference to opening a socket irrespective of you calling it from an IIS process, or a dedicated process.
I don't dispute that you are having problems though! It's always the way. I would have said that IIS is doing something to it's instance of the Winsock module, and that you are inherently calling through that instance when you use an in process server. I'd say that you have to figure out what it's doing and get it changed such that you can send the data in the way you need to. I can see the rationale behind the out of process server. I think it might solve your problem, but I have a feeling that you are just going to find different problems.
I appreciate that you don't need the performance, but if the performance is noticably low, then at the very least it's offering an easy denial of service attack to someone!
I doubt I can help you more than that, and even then I'm not sure my words help, but I do hope you find a way through. Battling MS products..... sadly it's the way of the world. I just can't count the number of times I've come across these sorts of hurdles.......
You're using this fantastic product, you just want it to do this extra thing. Ahh BUT. When you ask, does anyone know anything? Sympathies.
Edited by dilbert on Tuesday 9th October 12:39
Thanks for the support, I tend to agree with you that it should make no difference in terms of it being in process or out of process, but it does. As for the DOS attack, it is an internal system and is very unlikly to happen.
To be honest I am sure that there are other ways of doing this, it is just anoying me that it would take less than an afternoon to create an out of process exe to do what I want in VB, and yet after weeks of hunting (on and off) I cant find out how to do the same thing in c++. I would like to learn how to do it anyway, even if I adopt a different approach for this solution.
Thanks Any way.
To be honest I am sure that there are other ways of doing this, it is just anoying me that it would take less than an afternoon to create an out of process exe to do what I want in VB, and yet after weeks of hunting (on and off) I cant find out how to do the same thing in c++. I would like to learn how to do it anyway, even if I adopt a different approach for this solution.
Thanks Any way.
dilbert said:
Sorry I didn't get back yesterday. I actually found that page yesterday but didn't post a link because I wasn't sure if it applied to you. In fact it was why I was asking about the context of your call.
I don't know much about ASP, but I am pretty sure that you can't open a socket, format a packet and fire it off in an expicit way. I'm assuming that is what your COM object is for.
The thing to bear in mind here is that the performance that MS is on about with in, and out, of process servers is attributable to the way in which the binary image is used. So for example if you 50,000 people all using your page, that call the COM object, then you'll have 50,000 instances of of the code in memory at once if you use an out of process server.
With the in process server then the code segement of the app will be resident in memory once, and the, data segment will be replicated on a per user basis. It just saves all the extra disk activity of repeatedly loading the server.
O.K. So look at it a different way. Everybody used to write executables, until COM came along and allowed you to essentially implement dynamic, dynamic linking. The DLL already allowed the programmer to minimize memory utilization of code, and COM simplified the process of versioning DLL's in a dynamic way.
Recognizing COM as the versioning scheme that it is, it becomes clear that it is the DLL part of the deal which allows you to choose which process you wish to execute the code from.
The thing here is that a DLL does not make any distinction about the code you run. On it's own it's not a managed environment, you just call into whatever modules you can see, and want to use. I can't see why it should make a difference to opening a socket irrespective of you calling it from an IIS process, or a dedicated process.
I don't dispute that you are having problems though! It's always the way. I would have said that IIS is doing something to it's instance of the Winsock module, and that you are inherently calling through that instance when you use an in process server. I'd say that you have to figure out what it's doing and get it changed such that you can send the data in the way you need to. I can see the rationale behind the out of process server. I think it might solve your problem, but I have a feeling that you are just going to find different problems.
I appreciate that you don't need the performance, but if the performance is noticably low, then at the very least it's offering an easy denial of service attack to someone!
I doubt I can help you more than that, and even then I'm not sure my words help, but I do hope you find a way through. Battling MS products..... sadly it's the way of the world. I just can't count the number of times I've come across these sorts of hurdles.......
You're using this fantastic product, you just want it to do this extra thing. Ahh BUT. When you ask, does anyone know anything? Sympathies.
I don't know much about ASP, but I am pretty sure that you can't open a socket, format a packet and fire it off in an expicit way. I'm assuming that is what your COM object is for.
The thing to bear in mind here is that the performance that MS is on about with in, and out, of process servers is attributable to the way in which the binary image is used. So for example if you 50,000 people all using your page, that call the COM object, then you'll have 50,000 instances of of the code in memory at once if you use an out of process server.
With the in process server then the code segement of the app will be resident in memory once, and the, data segment will be replicated on a per user basis. It just saves all the extra disk activity of repeatedly loading the server.
O.K. So look at it a different way. Everybody used to write executables, until COM came along and allowed you to essentially implement dynamic, dynamic linking. The DLL already allowed the programmer to minimize memory utilization of code, and COM simplified the process of versioning DLL's in a dynamic way.
Recognizing COM as the versioning scheme that it is, it becomes clear that it is the DLL part of the deal which allows you to choose which process you wish to execute the code from.
The thing here is that a DLL does not make any distinction about the code you run. On it's own it's not a managed environment, you just call into whatever modules you can see, and want to use. I can't see why it should make a difference to opening a socket irrespective of you calling it from an IIS process, or a dedicated process.
I don't dispute that you are having problems though! It's always the way. I would have said that IIS is doing something to it's instance of the Winsock module, and that you are inherently calling through that instance when you use an in process server. I'd say that you have to figure out what it's doing and get it changed such that you can send the data in the way you need to. I can see the rationale behind the out of process server. I think it might solve your problem, but I have a feeling that you are just going to find different problems.
I appreciate that you don't need the performance, but if the performance is noticably low, then at the very least it's offering an easy denial of service attack to someone!
I doubt I can help you more than that, and even then I'm not sure my words help, but I do hope you find a way through. Battling MS products..... sadly it's the way of the world. I just can't count the number of times I've come across these sorts of hurdles.......
You're using this fantastic product, you just want it to do this extra thing. Ahh BUT. When you ask, does anyone know anything? Sympathies.
Edited by dilbert on Tuesday 9th October 12:39[/footnote]
[footnote]Edited by bholleran on Tuesday 9th October 12:56bholleran said:
Thanks for the support, I tend to agree with you that it should make no difference in terms of it being in process or out of process, but it does. As for the DOS attack, it is an internal system and is very unlikly to happen.
To be honest I am sure that there are other ways of doing this, it is just anoying me that it would take less than an afternoon to create an out of process exe to do what I want in VB, and yet after weeks of hunting (on and off) I cant find out how to do the same thing in c++. I would like to learn how to do it anyway, even if I adopt a different approach for this solution.
Thanks Any way.
Well I just checked my really old help documentation and there are two C++ examples that MS offer that appear to describe how to achieve exactly what you are asking to do. "Locclien/Locserve".To be honest I am sure that there are other ways of doing this, it is just anoying me that it would take less than an afternoon to create an out of process exe to do what I want in VB, and yet after weeks of hunting (on and off) I cant find out how to do the same thing in c++. I would like to learn how to do it anyway, even if I adopt a different approach for this solution.
Thanks Any way.
dilbert said:
Sorry I didn't get back yesterday. I actually found that page yesterday but didn't post a link because I wasn't sure if it applied to you. In fact it was why I was asking about the context of your call.
I don't know much about ASP, but I am pretty sure that you can't open a socket, format a packet and fire it off in an expicit way. I'm assuming that is what your COM object is for.
The thing to bear in mind here is that the performance that MS is on about with in, and out, of process servers is attributable to the way in which the binary image is used. So for example if you 50,000 people all using your page, that call the COM object, then you'll have 50,000 instances of of the code in memory at once if you use an out of process server.
With the in process server then the code segement of the app will be resident in memory once, and the, data segment will be replicated on a per user basis. It just saves all the extra disk activity of repeatedly loading the server.
O.K. So look at it a different way. Everybody used to write executables, until COM came along and allowed you to essentially implement dynamic, dynamic linking. The DLL already allowed the programmer to minimize memory utilization of code, and COM simplified the process of versioning DLL's in a dynamic way.
Recognizing COM as the versioning scheme that it is, it becomes clear that it is the DLL part of the deal which allows you to choose which process you wish to execute the code from.
The thing here is that a DLL does not make any distinction about the code you run. On it's own it's not a managed environment, you just call into whatever modules you can see, and want to use. I can't see why it should make a difference to opening a socket irrespective of you calling it from an IIS process, or a dedicated process.
I don't dispute that you are having problems though! It's always the way. I would have said that IIS is doing something to it's instance of the Winsock module, and that you are inherently calling through that instance when you use an in process server. I'd say that you have to figure out what it's doing and get it changed such that you can send the data in the way you need to. I can see the rationale behind the out of process server. I think it might solve your problem, but I have a feeling that you are just going to find different problems.
I appreciate that you don't need the performance, but if the performance is noticably low, then at the very least it's offering an easy denial of service attack to someone!
I doubt I can help you more than that, and even then I'm not sure my words help, but I do hope you find a way through. Battling MS products..... sadly it's the way of the world. I just can't count the number of times I've come across these sorts of hurdles.......
You're using this fantastic product, you just want it to do this extra thing. Ahh BUT. When you ask, does anyone know anything? Sympathies.
I don't know much about ASP, but I am pretty sure that you can't open a socket, format a packet and fire it off in an expicit way. I'm assuming that is what your COM object is for.
The thing to bear in mind here is that the performance that MS is on about with in, and out, of process servers is attributable to the way in which the binary image is used. So for example if you 50,000 people all using your page, that call the COM object, then you'll have 50,000 instances of of the code in memory at once if you use an out of process server.
With the in process server then the code segement of the app will be resident in memory once, and the, data segment will be replicated on a per user basis. It just saves all the extra disk activity of repeatedly loading the server.
O.K. So look at it a different way. Everybody used to write executables, until COM came along and allowed you to essentially implement dynamic, dynamic linking. The DLL already allowed the programmer to minimize memory utilization of code, and COM simplified the process of versioning DLL's in a dynamic way.
Recognizing COM as the versioning scheme that it is, it becomes clear that it is the DLL part of the deal which allows you to choose which process you wish to execute the code from.
The thing here is that a DLL does not make any distinction about the code you run. On it's own it's not a managed environment, you just call into whatever modules you can see, and want to use. I can't see why it should make a difference to opening a socket irrespective of you calling it from an IIS process, or a dedicated process.
I don't dispute that you are having problems though! It's always the way. I would have said that IIS is doing something to it's instance of the Winsock module, and that you are inherently calling through that instance when you use an in process server. I'd say that you have to figure out what it's doing and get it changed such that you can send the data in the way you need to. I can see the rationale behind the out of process server. I think it might solve your problem, but I have a feeling that you are just going to find different problems.
I appreciate that you don't need the performance, but if the performance is noticably low, then at the very least it's offering an easy denial of service attack to someone!
I doubt I can help you more than that, and even then I'm not sure my words help, but I do hope you find a way through. Battling MS products..... sadly it's the way of the world. I just can't count the number of times I've come across these sorts of hurdles.......
You're using this fantastic product, you just want it to do this extra thing. Ahh BUT. When you ask, does anyone know anything? Sympathies.
Edited by dilbert on Tuesday 9th October 12:39[/footnote]
[footnote]Edited by bholleran on Tuesday 9th October 12:56I don't know if it helps, but I came across this lovely little article all about the basics of COM, and marshalling during my journey to a different place today;
http://www.microsoft.com/msj/0897/free.aspx
It's a pretty old article, so I'm referring to a time when COM was young. If you already know all of that stuff, then good on you. What it outlines is some of the problems you're going to run into and ways to get out of them, when you deviate from what I have always considered the norm.
Whenever I write COM objects, or clients, I just assume the single threaded appartment model. For me, it always avoids the need to rely on mashalling, and I write multi threaded code that is clean enough that I can remember where my boundaries are. If I need marshalling I do it myself.
Reading this article made me realise that I take on the more difficult end of the whole deal client or server, mainly because I write more clients than objects. One would hope that people who write objects also take on the difficult end of the deal, such that a basic level of integrity is always maintained, but you cannot guarantee that!
All I know, is that if you're going to write both, then you have to do the difficult bit somewhere, for fear of ending up in siezure! I suppose if you write both, at least overall you only have to do the job once.

http://www.microsoft.com/msj/0897/free.aspx
It's a pretty old article, so I'm referring to a time when COM was young. If you already know all of that stuff, then good on you. What it outlines is some of the problems you're going to run into and ways to get out of them, when you deviate from what I have always considered the norm.
Whenever I write COM objects, or clients, I just assume the single threaded appartment model. For me, it always avoids the need to rely on mashalling, and I write multi threaded code that is clean enough that I can remember where my boundaries are. If I need marshalling I do it myself.
Reading this article made me realise that I take on the more difficult end of the whole deal client or server, mainly because I write more clients than objects. One would hope that people who write objects also take on the difficult end of the deal, such that a basic level of integrity is always maintained, but you cannot guarantee that!
All I know, is that if you're going to write both, then you have to do the difficult bit somewhere, for fear of ending up in siezure! I suppose if you write both, at least overall you only have to do the job once.

Edited by dilbert on Wednesday 10th October 03:51
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


