Click here to Skip to main content
13,631,244 members
Rate this:
Please Sign up or sign in to vote.
So I'm wondering if there is a way to expose a Managed Windows Service on Windows Server without IIS?

we had a working sample for an admin user, however because this is an ADFS type situation, when any other user attempts to access the SVC they are shot down (500);

(links or even specific search topics are good)
Posted 18-Mar-11 4:09am
ely_bob 18-Mar-11 10:22am
it's maybe possible if you open up "everyone" for install privileges on the server, then install, close "everyone" .. say 25% chance of success?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

First of all: Windows Service itself have nothing to do with IIS at all. This is just a general-purpose Service hosted by OS in a special way — using Service Control Magager, see [^],[^]. With a managed platform (.NET) it can communicate with applications and other services on the same or remote machines using number of ways: WCF or remoting, low-level sockets, named pipes (on the same system) and more.

It is not clear what do you mean by "ADFS situation", most likely, you mean "Active Directory" (if disambiguation is still needed:[^]). So what? You can use it, too. "SVC" also needs disambiguation. Is it "Service cannot start" of what? Where is your code? How the problem is manifested? Please describe your problem with sufficient level of detail and… try to use less abbreviations.

If your want to find bugs in a Windows Service, you need to catch all exceptions at the top of stack of each thread and log them properly. The most reliable way of logging is the System Event Log.
Find some code samples of System.EventLog here:
How to create event log under a folder[^]
MsBuild OutPut to the TextBox on the fly in Windows Application[^].

Using debugger is also quite possible, you should be able to attach the debugger to existing already running process. Refer to debugger documentation. It need thorough planning of your debugging session, otherwise you will miss the problems if they occur in the very beginning of the Service start.

ely_bob 19-Mar-11 12:18pm
The problem is making a service endpoint on a server which is exposed to an intranet, where the server CANNOT leverage WAS/IIS, but could potentially use HTTP.sys(?) to expose an *.ashx, *.scv endpoint.

You cannot use a system event log if you cannot get access into the WindowsService that runs the code to do the logging.

This isn't a code question it's a systems architecture/Implementation plan question. the code is trivial.
Sergey Alexandrovich Kryukov 19-Mar-11 15:11pm
I really don't understand what prevents using EventLog. I did not mean you need to "access" anything. I mean Windows Service itself can use EventLog.
I don't see big architectural problem here (and I cannot say the code is trivial). I don't think you explain the problem. What is it, after all?
ely_bob 20-Mar-11 12:15pm
So you have 2 ways to run code that can be executed from off the MACHINE, A) as a WindowsService (code trivial)B) as a handler(ASHX)/service(WCF(REST/SOAP)).. In the case of A: for a call to be made from the intranet webform solution you must access the MACHINE as a user who has execute privileges, which is automatic with IIS/WAS, for all users, but is not possible AFIK to implement a secure everyone implementation of a WIndowsService...(note there are two different services that are being discussed in this post, WindowsService and WebService (in the spirit of WCF))

So yes you can run a WindowsService, but only if you are accessing the MACHINE as the appropriate user, which IIS takes care of for you behind the scenes.. is there a way to do this WITHOUT IIS/WAS?
I cannot understand you. "So yes you can run a WindowsService, but only if you are accessing the..." Windows Service is exclusively a notion of a local machine. There is no such thing as "visibility" of Windows Service.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web02-2016 | 2.8.180712.1 | Last Updated 18 Mar 2011
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100