2

I have a C# web application developed and web deploy ready - meaning I have the WebApp.Web.zip file ready. I have verified that manual import of this application in my IIS 7.0 manager works and I am able to run the application in the browser.

Open IIS Manager (cmd->inetmgr), and explore the "Sites -> Default Web Site", and click on "Import Application" on the Right menu under Deploy. Browse to the path of the AAA.Web.zip and click "open". Go through the Package Import wizard. Click on "Browse *:80".

I now want to programmatically do the import of this application in the local IIS Server. Could you help me with some pointers?

adelphia
  • 187
  • 1
  • 2
  • 14

2 Answers2

1

So If all that you want is to host your WebApplication in IIS, and you don't want to do it all the way manually.

There is a neat way to do so,

Create a WebSetup Project. i.e. Add a New Project into the Solution of your Existing WebApplication i.e. inside visual studio, Add New Project, go to

Other Project Types >>Setup And Deployment >> Visual Studio Installer >> Web Setup Project

Just add Primary Output and Content Files of your WebApplication to the Setup Project and you are done. All you have to do is to build your solution.

And inside the bin folder of your Setup Project, you will get an .exe, which upon installation, hosts the WebApplication in IIS.

see more about creating a setup Project in visual studio

atleast it is cleaner than WebDeploy Command Line Syntax

Manish Mishra
  • 12,163
  • 5
  • 35
  • 59
  • 1
    I forgot to mention that my project is built in VS 2012 which does not have the setup and deployment mechanism. – adelphia Mar 28 '13 at 19:01
  • ohh in that case see [this link](http://stackoverflow.com/questions/12378125/create-msi-or-setup-project-with-visual-studio-2012) – Manish Mishra Mar 28 '13 at 20:07
0

Just use the webdeploy command line in your buildscript or from a Process object

http://technet.microsoft.com/en-us/library/dd569106(v=ws.10).aspx

Microsoft basically doesn't let you hook in with an API, there are a few ways to hack through it, but honestly you'll be better off using the command line

see this old answer

Community
  • 1
  • 1
yasth
  • 171
  • 5