Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable ASP.NET in IIS6 Programmatically

Is there a way to enable the ASP.NET Web Service Extension in IIS6 via C#? I'm trying to simplify a website setup program for people who haven't used IIS before.

like image 620
Jake Pearson Avatar asked Jan 23 '23 02:01

Jake Pearson


2 Answers

C# NET. Framework usage:

Process.Start(@"C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis", "-i -enable");

CMD usage:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -i -enable

It's useful.

Source: https://serverfault.com/questions/1649/why-does-iis-refuse-to-serve-asp-net-content

like image 153
it3xl Avatar answered Jan 25 '23 15:01

it3xl


You could call out to WMI easily enough (System.Management namespace, IIRC) and I believe you can set it from there. However, it may well be much simpler to set it manually, you can't do it from within an ASP.NET site since your server won't be able to run it until it is set...

Principles of doing something similar may be found here

like image 45
ZombieSheep Avatar answered Jan 25 '23 15:01

ZombieSheep