Back to the main page
Can't find the answer? Ask
Submit Articles
Publish your articles and reach thousands of readers worldwide.
Publish
■ Welcome Guest, LogIn
■ Login with 
Category : Computers & Internet » Programming » .Net | Posted by : CDR | Posted on : 3/25/2011 | Updated on : 3/25/2011
Keywords : delete, access, websites, net, change, programmatically, configure, iis7, add
Configure IIS7 programmatically from .net 3 or 4 ?
how can i access IIS7 from .net and add, delete change websites ?

Answers
you can use the Microsoft.Web.Administration to control IIS7, you need to add the file Microsoft.Web.Administration.dll to your project.
also your application need admin access.

thanks but i got this error while compiling:

Warning 2
The referenced assembly "Microsoft.Web.Administration, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.

and this error too:

The type or namespace name 'Web' does not exist in the namespace 'Microsoft'

try changing the TARGET FRAMEWORK from .NET 4 Client Profile to .NET FRAMEWORK 4

it works, but how i grant permission from the visual studio ?

"Cannot read configuration file due to insufficient permissions"

i found this solution :
1. Add IIS_IUSRS with Read permission on files in the folder
2. Change IIS authentication method to BasicAuthentication
3. refresh the website.

but i'm using a webform not a website or wcf.

if you run Visual Studio with administrator previleges, you application will have the permissions too.
You have an answer to this question?
Answer this question as a guest or ( Login / Create an account )
Full name : e-mail :  * will not be displayed
Retype the picture text
Send your Answer

Other languages : Verkus in English English, Verkus en Français Français. Terms of use | Privacy Policy | Help © Verkus 2008-2010, All rights reserved.