Implementing an Interface within a Windows Service 
Author Message
 Implementing an Interface within a Windows Service

In short, I want to convert an application I've done as a Windows Service in
VC++ 6.0 to a C# Windows Service.  The Windows Service is a search engine
with one basic method called 'Search'.  This method is called from an ASP
page like this:

Set myObject = Server.CreateObject("MySearchEngine.SearchQuery")
Res = myObject.Search(Query, Results)

I don't want to implement remoting at this point, but I'd like to know how
to develop this as a multi-threaded Windows Service.  There is a lot of data
that resides in memory for this service.

I've been looking at C# part-time, but can't seem to find the right answer.
Any thoughts?

Any thoughts?

Thanks,

Paul

By the way, here's a portion of the old .IDL file:

import "oaidl.idl";
import "ocidl.idl";
 [
  object,
  uuid(5AA51B01-DFC1-4953-B5EC-330C9099FC82),
  dual,
  helpstring("ISearchQuery Interface"),
  pointer_default(unique)
 ]
 interface ISearchQuery : IDispatch
 {
  [id(6), helpstring("method Search")] HRESULT Search([in] BSTR queryString,
[in] BSTR fullTextQueryString, [in] BSTR rankingString, VARIANT Options,
VARIANT Roles, [out] VARIANT* ModifiedQueryString, [out] VARIANT*
TopResources, [out] VARIANT* pSelectedResources, [out] VARIANT*
pSelectedResourcesRelevance, [out] VARIANT* pUsedTerms, [out] VARIANT*
pFreeTerms, [out] VARIANT* pFreeTermsCount, [out] VARIANT* pFullTextTerms,
[out, retval] VARIANT_BOOL *pResults);
 };

[
 uuid(A2514671-62A9-4EC9-ACC3-4BE4BA848CBC),
 version(1.0),
 helpstring("MySearchEngine 1.0 Type Library")
]
library MySearchEngineLib
{
 importlib("stdole32.tlb");
 importlib("stdole2.tlb");

 [
  uuid(A3CC7795-C864-43E0-858E-780154BD4EDB),
  helpstring("SearchQuery Class")
 ]
 coclass SearchQuery
 {
  [default] interface ISearchQuery;
 };

Quote:
};



Sun, 07 Nov 2004 19:46:13 GMT  
 Implementing an Interface within a Windows Service
Paul,

    I would actually develop a COM+ component for something like this.  This
way, you can run it as a service (or emulate it, as it would run out of
process and be created when needed and keep running).

    If you choose this route, then I you will want to look at the
System.EnterpriseServices namespace and the classes in there.

    If you go the COM+ route, then you can easily call your components from
ASP and in .NET, with minimal changes to the ASP code.

    How you will lay it out however, will depend on how much data you need
to store in memory.  If you want more details, or have more questions, feel
free to ask.

    Hope this helps.

--
               - Nicholas Paldino [.NET MVP]


Quote:
> In short, I want to convert an application I've done as a Windows Service
in
> VC++ 6.0 to a c# Windows Service.  The Windows Service is a search engine
> with one basic method called 'Search'.  This method is called from an ASP
> page like this:

> Set myObject = Server.CreateObject("MySearchEngine.SearchQuery")
> Res = myObject.Search(Query, Results)

> I don't want to implement remoting at this point, but I'd like to know how
> to develop this as a multi-threaded Windows Service.  There is a lot of
data
> that resides in memory for this service.

> I've been looking at C# part-time, but can't seem to find the right
answer.
> Any thoughts?

> Any thoughts?

> Thanks,

> Paul

> By the way, here's a portion of the old .IDL file:

> import "oaidl.idl";
> import "ocidl.idl";
>  [
>   object,
>   uuid(5AA51B01-DFC1-4953-B5EC-330C9099FC82),
>   dual,
>   helpstring("ISearchQuery Interface"),
>   pointer_default(unique)
>  ]
>  interface ISearchQuery : IDispatch
>  {
>   [id(6), helpstring("method Search")] HRESULT Search([in] BSTR
queryString,
> [in] BSTR fullTextQueryString, [in] BSTR rankingString, VARIANT Options,
> VARIANT Roles, [out] VARIANT* ModifiedQueryString, [out] VARIANT*
> TopResources, [out] VARIANT* pSelectedResources, [out] VARIANT*
> pSelectedResourcesRelevance, [out] VARIANT* pUsedTerms, [out] VARIANT*
> pFreeTerms, [out] VARIANT* pFreeTermsCount, [out] VARIANT* pFullTextTerms,
> [out, retval] VARIANT_BOOL *pResults);
>  };

> [
>  uuid(A2514671-62A9-4EC9-ACC3-4BE4BA848CBC),
>  version(1.0),
>  helpstring("MySearchEngine 1.0 Type Library")
> ]
> library MySearchEngineLib
> {
>  importlib("stdole32.tlb");
>  importlib("stdole2.tlb");

>  [
>   uuid(A3CC7795-C864-43E0-858E-780154BD4EDB),
>   helpstring("SearchQuery Class")
>  ]
>  coclass SearchQuery
>  {
>   [default] interface ISearchQuery;
>  };
> };



Sun, 07 Nov 2004 21:03:18 GMT  
 Implementing an Interface within a Windows Service
ACTUALLY why have a windows service for this at all?

Nicholas, you are totally right - a COM+ appliation (Serviced Component's)
look exactly like what is needed.

And poor Paul better gets someone with experience on this - we probably talk
of a resoruce manager / dispenser and this is not too simple..

--
Regards

Thomas Tomiczek
THONA Consulting Ltd.
(Microsoft MVP C#/.NET)



Quote:
> Paul,

>     I would actually develop a COM+ component for something like this.
This
> way, you can run it as a service (or emulate it, as it would run out of
> process and be created when needed and keep running).

>     If you choose this route, then I you will want to look at the
> System.EnterpriseServices namespace and the classes in there.

>     If you go the COM+ route, then you can easily call your components
from
> ASP and in .NET, with minimal changes to the ASP code.

>     How you will lay it out however, will depend on how much data you need
> to store in memory.  If you want more details, or have more questions,
feel
> free to ask.

>     Hope this helps.

> --
>                - Nicholas Paldino [.NET MVP]



> > In short, I want to convert an application I've done as a Windows
Service
> in
> > VC++ 6.0 to a c# Windows Service.  The Windows Service is a search
engine
> > with one basic method called 'Search'.  This method is called from an
ASP
> > page like this:

> > Set myObject = Server.CreateObject("MySearchEngine.SearchQuery")
> > Res = myObject.Search(Query, Results)

> > I don't want to implement remoting at this point, but I'd like to know
how
> > to develop this as a multi-threaded Windows Service.  There is a lot of
> data
> > that resides in memory for this service.

> > I've been looking at C# part-time, but can't seem to find the right
> answer.
> > Any thoughts?

> > Any thoughts?

> > Thanks,

> > Paul

> > By the way, here's a portion of the old .IDL file:

> > import "oaidl.idl";
> > import "ocidl.idl";
> >  [
> >   object,
> >   uuid(5AA51B01-DFC1-4953-B5EC-330C9099FC82),
> >   dual,
> >   helpstring("ISearchQuery Interface"),
> >   pointer_default(unique)
> >  ]
> >  interface ISearchQuery : IDispatch
> >  {
> >   [id(6), helpstring("method Search")] HRESULT Search([in] BSTR
> queryString,
> > [in] BSTR fullTextQueryString, [in] BSTR rankingString, VARIANT Options,
> > VARIANT Roles, [out] VARIANT* ModifiedQueryString, [out] VARIANT*
> > TopResources, [out] VARIANT* pSelectedResources, [out] VARIANT*
> > pSelectedResourcesRelevance, [out] VARIANT* pUsedTerms, [out] VARIANT*
> > pFreeTerms, [out] VARIANT* pFreeTermsCount, [out] VARIANT*
pFullTextTerms,
> > [out, retval] VARIANT_BOOL *pResults);
> >  };

> > [
> >  uuid(A2514671-62A9-4EC9-ACC3-4BE4BA848CBC),
> >  version(1.0),
> >  helpstring("MySearchEngine 1.0 Type Library")
> > ]
> > library MySearchEngineLib
> > {
> >  importlib("stdole32.tlb");
> >  importlib("stdole2.tlb");

> >  [
> >   uuid(A3CC7795-C864-43E0-858E-780154BD4EDB),
> >   helpstring("SearchQuery Class")
> >  ]
> >  coclass SearchQuery
> >  {
> >   [default] interface ISearchQuery;
> >  };
> > };



Sun, 07 Nov 2004 21:20:21 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. how to stop a windows service within my code

2. Active Messaging within a Windows NT service

3. nt service(windows service)

4. nt service (windows service)

5. Windows Service Deployment and Service registration

6. Can not access web service from C# Windows Service

7. Windows service (System.ServiceProcess.ServiceBase)

8. Windows Service (not a web service) question

9. How to Implement a screen capture within program?

10. Implementing "ls" from within C

11. How to implement MDI within OCX?

12. Create a Windows proc failure in a service App of Windows NT

 

 
Powered by phpBB® Forum Software