 |
|
 |
|
Next: set <meta http-equiv="Content-Type" ..
|
| Author |
Message |
External

Since: Aug 27, 2007 Posts: 2
|
(Msg. 1) Posted: Mon Aug 27, 2007 2:38 am
Post subject: Start, Stop IIS6 sites programmatically with wmi Archived from groups: microsoft>public>inetserver>iis (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
External

Since: Aug 23, 2003 Posts: 3146
|
(Msg. 2) Posted: Mon Aug 27, 2007 9:54 am
Post subject: Re: Start, Stop IIS6 sites programmatically with wmi [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Hi,
I don't have a complete code sample, but i think this may help (it may
have some errors, i don't have any reference in front of me right now):
ManagementObject webSite = new ManagementObject(...);
// Check if the website is stopped or paused
if ((int)webSite["ServerState"] == 4 || (int)webSite["ServerState"] == 6)
{
webSite.InvokeMethod("Start", null);
}
To stop the website, it should be if i remembers correctly:
webSite.InvokeMethod("Stop", null);
--
Regards,
Kristofer Gafvert
http://www.gafvert.info/iis/ - IIS Related Info
Shane wrote:
>
>Hi,
>
>I'm looking for help with starting and stop sites using WMI and C#. So far
>I've been able to connect to IIS6 on a remote server, create the site and
>directories etc. but the sites are stopped by default.
>
>Any code examples would be appreciated
>
>thanks >> Stay informed about: Start, Stop IIS6 sites programmatically with wmi |
|
| Back to top |
|
 |  |
External

Since: Aug 27, 2007 Posts: 2
|
(Msg. 3) Posted: Tue Aug 28, 2007 3:40 am
Post subject: Re: Start, Stop IIS6 sites programmatically with wmi [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Hi,
that's it, thanks!
the problem was I was re-using the same ManagementPath.relativePath from
when I invoked the CreateNewSite method.
the working code is
myPath.RelativePath = "IIsWebServer.Name='W3SVC/" + iisidentifer + "'";
//iisidentifer is parsed from the return code from createnewsite method
using (nac = new ManagementObject(scope, myPath, null))
{
if ((int)nac["ServerState"] == 4 ||
(int)nac["ServerState"] == 6)
{
nac.InvokeMethod("Start", null);
}
}
> Hi,
>
> I don't have a complete code sample, but i think this may help (it may
> have some errors, i don't have any reference in front of me right now):
>
> ManagementObject webSite = new ManagementObject(...);
>
> // Check if the website is stopped or paused
> if ((int)webSite["ServerState"] == 4 || (int)webSite["ServerState"] == 6)
> {
> webSite.InvokeMethod("Start", null);
>
> }
>
>
> To stop the website, it should be if i remembers correctly:
>
> webSite.InvokeMethod("Stop", null);
>
> --
> Regards,
> Kristofer Gafvert
> http://www.gafvert.info/iis/ - IIS Related Info
>
>
> Shane wrote:
>
> >
> >Hi,
> >
> >I'm looking for help with starting and stop sites using WMI and C#. So far
> >I've been able to connect to IIS6 on a remote server, create the site and
> >directories etc. but the sites are stopped by default.
> >
> >Any code examples would be appreciated
> >
> >thanks
> >> Stay informed about: Start, Stop IIS6 sites programmatically with wmi |
|
| Back to top |
|
 |  |
External

Since: Aug 23, 2003 Posts: 3146
|
(Msg. 4) Posted: Tue Aug 28, 2007 10:18 am
Post subject: Re: Start, Stop IIS6 sites programmatically with wmi [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Great! I am glad to hear that you got it working.
Good luck with the rest of the code, and you know where we are if you need
help.
--
Regards,
Kristofer Gafvert
http://www.gafvert.info/iis/ - IIS Related Info
Shane wrote:
>Hi,
>that's it, thanks!
>the problem was I was re-using the same ManagementPath.relativePath from
>when I invoked the CreateNewSite method.
>
>the working code is
>
>myPath.RelativePath = "IIsWebServer.Name='W3SVC/" + iisidentifer + "'";
>//iisidentifer is parsed from the return code from createnewsite method
> using (nac = new ManagementObject(scope, myPath, null))
> {
> if ((int)nac["ServerState"] == 4 ||
>(int)nac["ServerState"] == 6)
> {
> nac.InvokeMethod("Start", null);
>
> }
> }
>
>>Hi,
>>
>>I don't have a complete code sample, but i think this may help (it may
>>have some errors, i don't have any reference in front of me right now):
>>
>>ManagementObject webSite = new ManagementObject(...);
>>
>>// Check if the website is stopped or paused
>>if ((int)webSite["ServerState"] == 4 || (int)webSite["ServerState"] == 6)
>>{
>> webSite.InvokeMethod("Start", null);
>>
>>}
>>
>>
>>To stop the website, it should be if i remembers correctly:
>>
>>webSite.InvokeMethod("Stop", null);
>>
>>--
>>Regards,
>>Kristofer Gafvert
>>http://www.gafvert.info/iis/ - IIS Related Info
>>
>>
>>Shane wrote:
>>
>>>
>>>Hi,
>>>
>>>I'm looking for help with starting and stop sites using WMI and C#. So
>>>far
>>>I've been able to connect to IIS6 on a remote server, create the site and
>>>directories etc. but the sites are stopped by default.
>>>
>>>Any code examples would be appreciated
>>>
>>>thanks
>> >> Stay informed about: Start, Stop IIS6 sites programmatically with wmi |
|
| Back to top |
|
 |  |
External

Since: Sep 03, 2010 Posts: 1
|
(Msg. 5) Posted: Fri Sep 03, 2010 1:25 pm
Post subject: where is place that code i perticular time [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
where is place that code i perticular time
> On Monday, August 27, 2007 5:38 AM Shan wrote:
> Hi,
>
> I'm looking for help with starting and stop sites using WMI and C#. So far
> I've been able to connect to IIS6 on a remote server, create the site and
> directories etc. but the sites are stopped by default.
>
> Any code examples would be appreciated
>
> thanks
>> On Monday, August 27, 2007 12:54 PM Kristofer Gafvert wrote:
>> Hi,
>>
>> I don't have a complete code sample, but i think this may help (it may
>> have some errors, i don't have any reference in front of me right now):
>>
>> ManagementObject webSite = new ManagementObject(...);
>>
>> // Check if the website is stopped or paused
>> if ((int)webSite["ServerState"] == 4 || (int)webSite["ServerState"] == 6)
>> {
>> webSite.InvokeMethod("Start", null);
>>
>> }
>>
>>
>> To stop the website, it should be if i remembers correctly:
>>
>> webSite.InvokeMethod("Stop", null);
>>
>> --
>> Regards,
>> Kristofer Gafvert
>> http://www.gafvert.info/iis/ - IIS Related Info
>>
>>
>> Shane wrote:
>>> On Tuesday, August 28, 2007 6:40 AM Shan wrote:
>>> Hi,
>>> that's it, thanks!
>>> the problem was I was re-using the same ManagementPath.relativePath from
>>> when I invoked the CreateNewSite method.
>>>
>>> the working code is
>>>
>>> myPath.RelativePath = "IIsWebServer.Name='W3SVC/" + iisidentifer + "'";
>>> //iisidentifer is parsed from the return code from createnewsite method
>>> using (nac = new ManagementObject(scope, myPath, null))
>>> {
>>> if ((int)nac["ServerState"] == 4 ||
>>> (int)nac["ServerState"] == 6)
>>> {
>>> nac.InvokeMethod("Start", null);
>>>
>>> }
>>> }
>>>> On Tuesday, August 28, 2007 1:18 PM Kristofer Gafvert wrote:
>>>> Great! I am glad to hear that you got it working.
>>>>
>>>> Good luck with the rest of the code, and you know where we are if you need
>>>> help.
>>>>
>>>>
>>>> --
>>>> Regards,
>>>> Kristofer Gafvert
>>>> http://www.gafvert.info/iis/ - IIS Related Info
>>>>
>>>>
>>>> Shane wrote:
>>>> Submitted via EggHeadCafe - Software Developer Portal of Choice
>>>> ObjectDumper LINQ To Export Collection Via .NET Reflection
>>>> http://www.eggheadcafe.com/tutorials/aspnet/21737599-5a63-4672-a32c-a3...a282a3f >> Stay informed about: Start, Stop IIS6 sites programmatically with wmi |
|
| Back to top |
|
 |  |
| Related Topics: | can't start/stop IIS 5 on XP Pro - I've screwed something up as things used to be working fine. For some reason, I am unable to access my localhost. When I open the IIS snap-in my computer is listed, but nothing else. I can't browse it, nor can I stop or start the service. When..
Set IIS 6.0 Execute Permission to None programmatically - The module is working and I need to add one more step to set "Execute Permission" to "None" programmatically. Any help me on what property name and value should i set here, would be appreciated - also where can i find exaustive li...
Logging seems to stop and start quite often - I've had reason lately to closely monitor the logs for one of our web sites (one created using host headers) (IIS 6, win 2003 sp2). Logs for the site is set to rotate monthly. The log file contains a great deal of this: #Software: Microsoft Internet...
start/stop services programatically - I am creating a setup project for an application and need to edit the Metabase.xml file during setup. Does anyone know of a way to stop and then restart services programatically before and after I edit this file? Vic
In Win2000PRO IIS Web Server can I do a manual start stop - Is there a way to set IIS to always have to be manually started and is there a way to always stop IIS so that it has to be manual's started on Shutdown and Reboot? This is help forgetful minds. Thanks Dave |
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
 |
|
|