Daryl Davis
6/14/2004 7:44:00 PM
I wish it did. I can call Dlls fine, except from a WebService...
I tried imitating your code and that did not help me either.
Daryl
"Stuart Hemming (via DFN-CIS NetNews Service)"
<shemming@estatecomputers.com> wrote in message
news:1226961532.20040614134939@estatecomputers.com...
On 11/06/2004, around 13:36, Daryl Davis wrote:
DD> Ok, so your as blunt as a rusty sword, go for a tree trunk.
DD> I am searching through the msdn and I am unable to figure out (might
just be
DD> early) how to get this to work with a server components.
FWIW, here's what I did.
I'm developing on a machine that has the server components on it so
YMMV.
In you VS project right click on 'References' on the project explorer
and select 'Add Reference'. When the dialog box opens, select the
'COM' tab and pick the COM server you're after. Click 'OK'. When the
machine has finished clicking and wrrring you should have a reference
named for your COM server.
Add a 'using' clause you get the thing recognised in your code and
you're away. Here's a simple example of my code accessing a COM server
called ECS ...
public XmlDocument InputValidation(XmlDocument ChangedValues) {
XmlDocument xmlDoc = new XmlDocument();
Ecs.EcsApplicationClass thisEcs;
thisEcs.Define("ecs-process", "input-validation");
thisEcs.InputText = ChangedValues.OuterXml;
thisEcs.RunProcess();
if (thisEcs.OutputText != null && thisEcs.OutputText != "") {
xmlDoc.LoadXml(thisEcs.OutputText);
// ...
}
return xmlDoc;
}
public void Logout() {
Ecs.EcsApplicationClass thisEcs;
if (Session["ecs"] != null) {
thisEcs = (Ecs.EcsApplicationClass)Session["ecs"];
Marshal.ReleaseComObject(thisEcs);
Session.Clear();
}
}
EcsApplicationClass is the constructor if you like, Define, and
RunProcess are methods, InputText and OutputText are properties. Not
that in Logout you have to call Marshal.ReleaseComObject else the
object remains on the server.
I hope this helps.
--
Stuart
See headers for PGP Key.
Once, in the Congo, I lost my corkscrew, and was forced to live on
nothing but food and water for days.