How to host a asp.net c# web project in a windows service. Please give some step by step instruction. . Please note that it is Not a webservice

Recommended Answers

All 7 Replies

An ASP.NET Web project is best hosted in IIS.
Is running IIS not an option?

An ASP.NET Web project is best hosted in IIS.
Is running IIS not an option?

No I want to place it outside IIS in a Windows Service .

Is that possible.

It's possible, but you'd have to provide all the stuff that IIS does for you, pretty much remaking IIS.

It's possible, but you'd have to provide all the stuff that IIS does for you, pretty much remaking IIS.

I will be very thankful to you , if you can provide the stpe by step instruction.

Thanks.

Not going to happen. You are talking about a piece of software than has at least 5 teams of developers working on it over multiple years.

Well, what is the app going to do that is web based that needs to run outside of IIS?
I can think of a couple of things, but they're not good.

If running an ASP.NET Web Site outside of IIS is your requirement, you picked the wrong architecture.

The only real way this will work is if you create a normal windows service with all your code in and that code also generates static html for your browser to parse. But that's all you can really do.
Browser connects on port and sends the normal request to a listening socket in your service. Service gets that request and outputs the HTML that your code generates, based on the command it received.

You're effectively writing a web-server, which in itself is an interesting project, but wholly unnecessary.

There's not that much wrong with IIS, why can't you use it?

PS. This is what a typical browser request looks like

GET /dumprequest HTTP/1.1
Host: djce.org.uk
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://www.google.co.uk/url?sa=t&rct=j&q=web+request+from+browser&source=web&cd=1&ved=0CDIQFjAA&url=http%3A%2F%2Fdjce.org.uk%2Fdumprequest&ei=_9lET8GkFYKu8QOf8pDLBA&usg=AFQjCNEeAn5wSZMp_y_oTmOKonq482sS9A&sig2=eFeEZOhqhgEZKfSEaqlw3Q
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

So you would need to parse that on your socket to make a decision about which method to run in your service.

It's possible, but it's bad. VERY BAD. Use IIS, or if you're running Linux, use the ASP .NET plugin for Apache. It's based on Mono so isn't completely up to date with the latest release but most major functionality is there.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.