473,320 Members | 2,012 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,320 software developers and data experts.

Restaring IIS through a Windows Service

I have wriiten a windows service that sends an HTTP request to a page hosted on each of our Web Servers in the Web Farm (the service runs on each server). If a response is not received, I want to restart IIS on that server and send myself and email.

The service runs fine, and I get the email when IIS is not responding. However, IIS doesn't restart, and there is no error message on the line of code. The line of code I am using to restart IIS from within the Windows Service is:

Shell("iisreset " & GetHostName(), vbHide)

Running iis reset <host> through a command prompt on the server does work, so I can't make out why the service can't.
Apr 16 '07 #1
1 947
Craig,

I don't have an answer to you question, it seems like it should work. However, I do have a question about the service that sends an HTTP request to a page. I am trying to do the same thing. I have a service that runs WSH vbscripts at noon everyday. It's a generic service that will rum a any scripts in a scripts folder. That way I can add/delete scripts as needed.

Anyway the following script runs great if lanched from the desktop

Dim oHttp
Source = "http://www.mysite.com/somepage.asp?Action=Test"
Set oHttp = CreateObject("Microsoft.XMLHTTP")
oHttp.Open "GET", Source, False
oHttp.Send
Set oHttp = Nothing

The webpage called sends an e-mail to test whether e-mail service are up.

But when the service fires at noon, we don't get an e-mails.

Would you mind sharing how you perform the HTTP request within your server?

Thanks in advance.

K.E.


I have wriiten a windows service that sends an HTTP request to a page hosted on each of our Web Servers in the Web Farm (the service runs on each server). If a response is not received, I want to restart IIS on that server and send myself and email.

The service runs fine, and I get the email when IIS is not responding. However, IIS doesn't restart, and there is no error message on the line of code. The line of code I am using to restart IIS from within the Windows Service is:

Shell("iisreset " & GetHostName(), vbHide)

Running iis reset <host> through a command prompt on the server does work, so I can't make out why the service can't.
May 11 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

11
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
1
by: Artur Kowalski | last post by:
I have a NotifyIcon in my Windows Service project and I am trying to add a ContextMenu to this NotifyIcon or use some of the mouse events. Everything isn't working. I think so base class of the...
9
by: SP | last post by:
Hi All, I wrote a windows service which is supposed to stop after specified amount of time. I am calling OnStop() after specified time. OnStop() methods executed but I dont see the service...
1
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. I'm having trouble getting the code that I've written to work, can anyone shed some light as to where I'm...
0
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. The program I'm trying to develop needs to be able to do the following: - Select remote server -...
2
by: deko | last post by:
When to use a privileged user thread rather than a windows service? That's the question raised in a previous post . It was suggested that if the service needs to interact with a WinForms app...
4
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
5
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name?...
1
by: =?Utf-8?B?TWFuanJlZSBHYXJn?= | last post by:
Hi, I created a web service that I want to host in windows service. The problem is that if I host it as windows service it does not use the configuration file. I have to define the binding,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.