473,395 Members | 1,443 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

A web service inside a windows service?

Is there a way to have a windows service instantiate a class that is a web
service, which will then be accessible to clients via HTTP?

Thanks,

-Mike

Jul 21 '05 #1
11 2220
I don't think a web service is internally capable of doing all the work.
I.e., it doesn't have the socket listening/request queuing code, it just
knows how to handle a request once one is handed to it. It still needs
to be hosted by some kind of web server, normally IIS, but you may be
able to modify the Cassini server to create something that could be
fully self-contained within a windows service:

http://www.asp.net/Default.aspx?tabindex=7&tabid=41

-Jason

Michael Riggio wrote:
Is there a way to have a windows service instantiate a class that is a web
service, which will then be accessible to clients via HTTP?

Thanks,

-Mike

Jul 21 '05 #2
This is a great start, thanks for the information!! Cassini seems pretty
straight forward (I'm stepping through the debugger), though it would be
really cool if it was a bit more simpler such that anyone can roll out their
own solution with relative ease.

Thanks!
"Jason DeFontes" <ja***@defontes.com> wrote in message
news:uM**************@tk2msftngp13.phx.gbl...
I don't think a web service is internally capable of doing all the work.
I.e., it doesn't have the socket listening/request queuing code, it just
knows how to handle a request once one is handed to it. It still needs
to be hosted by some kind of web server, normally IIS, but you may be
able to modify the Cassini server to create something that could be
fully self-contained within a windows service:

http://www.asp.net/Default.aspx?tabindex=7&tabid=41

-Jason

Michael Riggio wrote:
Is there a way to have a windows service instantiate a class that is a web service, which will then be accessible to clients via HTTP?

Thanks,

-Mike

Jul 21 '05 #3
Well, I'm not sure how much simpler you'd want it to be. Start IIS, drop
web service in wwwroot, go home. You're the one that wants to run it
from inside a Windows service, when it wasn't designed to work that way.
Your pain is self-inflicted.

Best of luck,

-Jason

Michael Riggio wrote:
This is a great start, thanks for the information!! Cassini seems pretty
straight forward (I'm stepping through the debugger), though it would be
really cool if it was a bit more simpler such that anyone can roll out their
own solution with relative ease.

Thanks!
"Jason DeFontes" <ja***@defontes.com> wrote in message
news:uM**************@tk2msftngp13.phx.gbl...
I don't think a web service is internally capable of doing all the work.
I.e., it doesn't have the socket listening/request queuing code, it just
knows how to handle a request once one is handed to it. It still needs
to be hosted by some kind of web server, normally IIS, but you may be
able to modify the Cassini server to create something that could be
fully self-contained within a windows service:

http://www.asp.net/Default.aspx?tabindex=7&tabid=41

-Jason

Michael Riggio wrote:

Is there a way to have a windows service instantiate a class that is a
web
service, which will then be accessible to clients via HTTP?

Thanks,

-Mike


Jul 21 '05 #4
Why not just use remoting?

"Michael Riggio" <mi************@unisys.nospam.com> wrote in message
news:O#*************@TK2MSFTNGP11.phx.gbl...
Is there a way to have a windows service instantiate a class that is a web
service, which will then be accessible to clients via HTTP?

Thanks,

-Mike

Jul 21 '05 #5
Isn't Remoting a different solution to that provided by Web Services? WS can
accept any SOAP client but Remoting requires (IIRC) .NET on the client.

"Ray Cassick (Home)" <rc************@enterprocity.com> wrote in message
news:OZ**************@TK2MSFTNGP11.phx.gbl...
Why not just use remoting?

"Michael Riggio" <mi************@unisys.nospam.com> wrote in message
news:O#*************@TK2MSFTNGP11.phx.gbl...
Is there a way to have a windows service instantiate a class that is a web service, which will then be accessible to clients via HTTP?

Thanks,

-Mike



Jul 21 '05 #6
Web Services are implementations of remoting. They are wrappers around the
remoting classes but they use the same remoting classes you would use are
used by web services.

Which is also the answer to your question. Your Windows service can
absolutely consume web services. Just remember that Windows services often
do not have a user account and if your web service is on a different server,
and doesn't have anonymous access allowed, you will get access denied unless
you assign a domain account for your Windows service to run under.

Dale

"DM McGowan II" <no****@nospam.net> wrote in message
news:up********************@comcast.com...
Isn't Remoting a different solution to that provided by Web Services? WS can accept any SOAP client but Remoting requires (IIRC) .NET on the client.

"Ray Cassick (Home)" <rc************@enterprocity.com> wrote in message
news:OZ**************@TK2MSFTNGP11.phx.gbl...
Why not just use remoting?

"Michael Riggio" <mi************@unisys.nospam.com> wrote in message
news:O#*************@TK2MSFTNGP11.phx.gbl...
Is there a way to have a windows service instantiate a class that is a web service, which will then be accessible to clients via HTTP?

Thanks,

-Mike


Jul 21 '05 #7
Web services are really just a remoted service hosted within IIS. They use
IIS as a transport (HTTP CHannel) and to manage the connections. Other than
that there is really very little difference. The major difference is that
web services are only allowed to use the SOAP Format for communications
while remoting can use either SOAP or a binary formatter.

You can write a remoted service, telkl it to use the SOAP formatter and the
HTTP channel and it is baisicaly a web service.

Personally, unless you are planning to exspose the service externally
(outside the enterprise) use remoting with the binary formatter. Faster,
less connecton overhead and IMHO a bit more secure because you don;t need a
machine running IIS to host it. You can just write a windows service.

Here is *some* links that show the differecnes:

http://www.developer.com/net/net/art...1087_2201701_1

http://dotnetjunkies.com/WebLog/chri...1/31/6385.aspx
"DM McGowan II" <no****@nospam.net> wrote in message
news:up********************@comcast.com...
Isn't Remoting a different solution to that provided by Web Services? WS can accept any SOAP client but Remoting requires (IIRC) .NET on the client.

"Ray Cassick (Home)" <rc************@enterprocity.com> wrote in message
news:OZ**************@TK2MSFTNGP11.phx.gbl...
Why not just use remoting?

"Michael Riggio" <mi************@unisys.nospam.com> wrote in message
news:O#*************@TK2MSFTNGP11.phx.gbl...
Is there a way to have a windows service instantiate a class that is a web service, which will then be accessible to clients via HTTP?

Thanks,

-Mike


Jul 21 '05 #8
I researched this recently then created a small benchmark to compare the
performance of Remoting SOAP to Remoting Binary.

Firstly, Remoting SOAP is not 100% compatible with Web Service SOAP and
there is more overhead in the case where you can coax it to work. This is
documented in numerous articles on the Web.

Next, I found Remoting SOAP to be a minimum of 5 times slower than Remoting
Binary so I agree that within the enterprise, binary is the best option
unless the design can't afford to have all clients tied to the .NET
Architecture which would put you back in Web Services. True Web Services not
Remoting pseudo web services.

Overall I'd say that Michael is right to start with the Cassini source and
design a solution from there.

"Ray Cassick (Home)" <rc************@enterprocity.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Web services are really just a remoted service hosted within IIS. They use
IIS as a transport (HTTP CHannel) and to manage the connections. Other than that there is really very little difference. The major difference is that
web services are only allowed to use the SOAP Format for communications
while remoting can use either SOAP or a binary formatter.

You can write a remoted service, telkl it to use the SOAP formatter and the HTTP channel and it is baisicaly a web service.

Personally, unless you are planning to exspose the service externally
(outside the enterprise) use remoting with the binary formatter. Faster,
less connecton overhead and IMHO a bit more secure because you don;t need a machine running IIS to host it. You can just write a windows service.

Here is *some* links that show the differecnes:

http://www.developer.com/net/net/art...1087_2201701_1

http://dotnetjunkies.com/WebLog/chri...1/31/6385.aspx
"DM McGowan II" <no****@nospam.net> wrote in message
news:up********************@comcast.com...
Isn't Remoting a different solution to that provided by Web Services? WS

can
accept any SOAP client but Remoting requires (IIRC) .NET on the client.

"Ray Cassick (Home)" <rc************@enterprocity.com> wrote in message
news:OZ**************@TK2MSFTNGP11.phx.gbl...
Why not just use remoting?

"Michael Riggio" <mi************@unisys.nospam.com> wrote in message
news:O#*************@TK2MSFTNGP11.phx.gbl...
> Is there a way to have a windows service instantiate a class that is
a web
> service, which will then be accessible to clients via HTTP?
>
> Thanks,
>
> -Mike
>
>
>



Jul 21 '05 #9
Simpler in the fact that what's in System.Web.Hosting doesn't include the
tcp listening objects that are really needed. Cassini provides wrapper
classes that allow an application to do exactly what I want, its just a
shame MS didn't add these classes to the framework to begin with, that's
all.

"Jason DeFontes" <ja***@defontes.com> wrote in message
news:Oz**************@TK2MSFTNGP09.phx.gbl...
Well, I'm not sure how much simpler you'd want it to be. Start IIS, drop
web service in wwwroot, go home. You're the one that wants to run it
from inside a Windows service, when it wasn't designed to work that way.
Your pain is self-inflicted.

Best of luck,

-Jason

Michael Riggio wrote:
This is a great start, thanks for the information!! Cassini seems pretty straight forward (I'm stepping through the debugger), though it would be
really cool if it was a bit more simpler such that anyone can roll out their own solution with relative ease.

Thanks!
"Jason DeFontes" <ja***@defontes.com> wrote in message
news:uM**************@tk2msftngp13.phx.gbl...
I don't think a web service is internally capable of doing all the work.
I.e., it doesn't have the socket listening/request queuing code, it just
knows how to handle a request once one is handed to it. It still needs
to be hosted by some kind of web server, normally IIS, but you may be
able to modify the Cassini server to create something that could be
fully self-contained within a windows service:

http://www.asp.net/Default.aspx?tabindex=7&tabid=41

-Jason

Michael Riggio wrote:
Is there a way to have a windows service instantiate a class that is a


web
service, which will then be accessible to clients via HTTP?

Thanks,

-Mike


Jul 21 '05 #10
I suppose a little background information is needed to describe my
situation. We have a windows service that constantly maintains a bunch of
objects in the background. We would like to expose these objects through a
web service. We're able to use COM to get access to the objects in the
windows service, but when we introduce the web service it means that we'll
be taking a performance hit when crossing process boundaries. I was hoping
that a solution similar to that provided by Cassini would eliminate the
costs of going cross process because the web service and windows service
would be under the same process, but I don't think it will (based on my
initial tests). We have a singleton object in the windows service that is
the main entry point to all the other objects and is created when the
windows service starts. When the web service (implemented inside the
windows service) attempts to access the singleton all the initialization
code gets executed again (as if the singleton was not created yet).

Does anyone have any other suggestions before I give up on this :)

Thanks!
"DM McGowan II" <no****@nospam.net> wrote in message
news:cr********************@comcast.com...
I researched this recently then created a small benchmark to compare the
performance of Remoting SOAP to Remoting Binary.

Firstly, Remoting SOAP is not 100% compatible with Web Service SOAP and
there is more overhead in the case where you can coax it to work. This is
documented in numerous articles on the Web.

Next, I found Remoting SOAP to be a minimum of 5 times slower than Remoting Binary so I agree that within the enterprise, binary is the best option
unless the design can't afford to have all clients tied to the .NET
Architecture which would put you back in Web Services. True Web Services not Remoting pseudo web services.

Overall I'd say that Michael is right to start with the Cassini source and
design a solution from there.

"Ray Cassick (Home)" <rc************@enterprocity.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Web services are really just a remoted service hosted within IIS. They use
IIS as a transport (HTTP CHannel) and to manage the connections. Other than
that there is really very little difference. The major difference is that web services are only allowed to use the SOAP Format for communications
while remoting can use either SOAP or a binary formatter.

You can write a remoted service, telkl it to use the SOAP formatter and

the
HTTP channel and it is baisicaly a web service.

Personally, unless you are planning to exspose the service externally
(outside the enterprise) use remoting with the binary formatter. Faster,
less connecton overhead and IMHO a bit more secure because you don;t need a
machine running IIS to host it. You can just write a windows service.

Here is *some* links that show the differecnes:

http://www.developer.com/net/net/art...1087_2201701_1
http://dotnetjunkies.com/WebLog/chri...1/31/6385.aspx

"DM McGowan II" <no****@nospam.net> wrote in message
news:up********************@comcast.com...
Isn't Remoting a different solution to that provided by Web Services? WS
can
accept any SOAP client but Remoting requires (IIRC) .NET on the

client.
"Ray Cassick (Home)" <rc************@enterprocity.com> wrote in message news:OZ**************@TK2MSFTNGP11.phx.gbl...
> Why not just use remoting?
>
> "Michael Riggio" <mi************@unisys.nospam.com> wrote in message
> news:O#*************@TK2MSFTNGP11.phx.gbl...
> > Is there a way to have a windows service instantiate a class that

is a web
> > service, which will then be accessible to clients via HTTP?
> >
> > Thanks,
> >
> > -Mike
> >
> >
> >
>
>


Jul 21 '05 #11
Are you giving up because you couldn't get it to work, or because you
think it isn't worth the trouble? I was talking out of my ass when I
suggested Cassini in the first place, so now I'm curious to know if it
was a dead end.

In my opinion, given the huge overhead inherent in the web service to
begin with, crossing a process boundary to get a COM object is a drop in
the bucket. Better off running the web service on top of IIS were you
can manage it more easily.

-Jason

Michael Riggio wrote:
I suppose a little background information is needed to describe my
situation. We have a windows service that constantly maintains a bunch of
objects in the background. We would like to expose these objects through a
web service. We're able to use COM to get access to the objects in the
windows service, but when we introduce the web service it means that we'll
be taking a performance hit when crossing process boundaries. I was hoping
that a solution similar to that provided by Cassini would eliminate the
costs of going cross process because the web service and windows service
would be under the same process, but I don't think it will (based on my
initial tests). We have a singleton object in the windows service that is
the main entry point to all the other objects and is created when the
windows service starts. When the web service (implemented inside the
windows service) attempts to access the singleton all the initialization
code gets executed again (as if the singleton was not created yet).

Does anyone have any other suggestions before I give up on this :)

Thanks!
"DM McGowan II" <no****@nospam.net> wrote in message
news:cr********************@comcast.com...
I researched this recently then created a small benchmark to compare the
performance of Remoting SOAP to Remoting Binary.

Firstly, Remoting SOAP is not 100% compatible with Web Service SOAP and
there is more overhead in the case where you can coax it to work. This is
documented in numerous articles on the Web.

Next, I found Remoting SOAP to be a minimum of 5 times slower than


Remoting
Binary so I agree that within the enterprise, binary is the best option
unless the design can't afford to have all clients tied to the .NET
Architecture which would put you back in Web Services. True Web Services


not
Remoting pseudo web services.

Overall I'd say that Michael is right to start with the Cassini source and
design a solution from there.

"Ray Cassick (Home)" <rc************@enterprocity.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl.. .
Web services are really just a remoted service hosted within IIS. They
use
IIS as a transport (HTTP CHannel) and to manage the connections. Other


than
that there is really very little difference. The major difference is
that
web services are only allowed to use the SOAP Format for communications
while remoting can use either SOAP or a binary formatter.

You can write a remoted service, telkl it to use the SOAP formatter and


the
HTTP channel and it is baisicaly a web service.

Personally, unless you are planning to exspose the service externally
(outside the enterprise) use remoting with the binary formatter. Faster,
less connecton overhead and IMHO a bit more secure because you don;t
need
a
machine running IIS to host it. You can just write a windows service.

Here is *some* links that show the differecnes:

http://www.developer.com/net/net/art...1087_2201701_1


http://dotnetjunkies.com/WebLog/chri...1/31/6385.aspx

"DM McGowan II" <no****@nospam.net> wrote in message
news:up********************@comcast.com...

Isn't Remoting a different solution to that provided by Web Services?
WS
can

accept any SOAP client but Remoting requires (IIRC) .NET on the
client.
"Ray Cassick (Home)" <rc************@enterprocity.com> wrote in
message
news:OZ**************@TK2MSFTNGP11.phx.gbl.. .

>Why not just use remoting?
>
>"Michael Riggio" <mi************@unisys.nospam.com> wrote in message
>news:O#*************@TK2MSFTNGP11.phx.gbl.. .
>
>>Is there a way to have a windows service instantiate a class that


is
a
web

>>service, which will then be accessible to clients via HTTP?
>>
>>Thanks,
>>
>>-Mike
>>
>>
>>
>
>


Jul 21 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Dmitri Shvetsov | last post by:
Hi All, Did somebody see the situation when the VS refuses to debug the Web Service at all? I can't catch why, the initially created Web Service can be debugged very easy but after some changes...
2
by: Neslihan ERDEM | last post by:
Every body Hi first of all I say Why do I need Windows Service / Every Day I create XML file . I writed a XML web service And .I join this servis Windows service. I create Windows Service that...
0
by: Jonathan G. | last post by:
I'm writing my first windows service. I have a class called 'mainprocess' whose constructor is called by the service class. Within mainprocess, I declare an instance of another class I wrote,...
12
by: Michael Riggio | last post by:
Is there a way to have a windows service instantiate a class that is a web service, which will then be accessible to clients via HTTP? Thanks, -Mike
4
by: Julia | last post by:
Hi, I have two application which 'evaluate'( New FileStream(path....) relative path, when evaluating the path inside a window service it always return something like ...
8
by: Julia | last post by:
Hi, My client uses a remote object when I host the remote object inside a windows application all seem to work fine but when I host the same object inside a windows service I get the following...
11
by: Frank Rizzo | last post by:
Hello, My c# based windows service takes a while to dispose. I have to release bunch of resources all over the place and unfortunately it can take 20-40 seconds before I can cleanly exit. ...
2
by: JD | last post by:
Hello, I'm experiencing a problem that I'm hoping someone might be able to shed some light on. I have an ASP.NET page on a Windows 2000 machine that makes web service calls to a .NET web...
7
by: Sunil Varma | last post by:
Hello all, I wrote a Windows Service in VC.NET 2005 I want to debug the solution. I tried as mentioned in the following link. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.