现在的位置: 首页 > 综合 > 正文

安装部署基础——Web Solution

2012年09月11日 ⁄ 综合 ⁄ 共 3346字 ⁄ 字号 评论关闭

In this walkthrough, you will create a simple Web Forms application using Visual Basic, and then create an installer to deploy the application to a Web server.

Note   Web Setup Projects are not available in the Standard Edition of Visual Basic .NET. For more information, see Visual Basic Standard Edition Features.

To create the Web Forms application

  1. On the File menu, point to New, and then choose Project.
  2. In the New Project dialog box, select Visual Basic Projects in the Project Types pane, and then choose ASP.NET Web Application in the Templates pane. In the Location box, type http://localhost/WebApp1.
  3. Click OK to close the dialog box.

    The project is added to Solution Explorer, and the Web Forms Designer opens.

  4. Select the Web Forms tab in the Toolbox.
  5. Select the Button control and drag it to the Web Form.
  6. Double-click the Button control to add an event handler for the button.
  7. In the event handler, add the following code:
    Button1.Text = "abc"

    This will change the text displayed on the button to "abc" when the button is clicked.

  8. On the Build menu, choose Build WebApp1 to build the application.

To create a deployment project

  1. On the File menu, point to Add Project, and then choose New Project.
  2. In the Add New Project dialog box, select Setup and Deployment Projects in the Project Type pane, and then choose Web Setup Project in the Templates pane. In the Name box, type WebDeploy.
  3. Click OK to close the dialog box.

    The project is added to Solution Explorer, and the File System Editor opens.

  4. In the Properties window, select the ProductName property and type WebApp1.

To add the output of the WebApp1 project to the deployment project

  1. In the File System Editor, select the Web Application folder. On the Action menu, point to Add, and then choose Project Output.
  2. In the Add Project Output Group dialog box, choose WebApp1 from the Project drop-down list.
  3. Click OK to close the dialog box.
  4. Select the Primary Output and Content Files groups from the list, then click OK.

To set properties for the installer

  1. Select the WebApplication folder. In the Properties window, set the VirtualDirectory property to xyz.
  2. In the Properties window, set the DefaultDocument property to WebForm1.aspx.
  3. On the Build menu, choose Build WebDeploy.

To deploy the application to a Web server on your development computer

  1. In Solution Explorer, select the WebDeploy project. On the Project menu, choose Install.

    Note   You must have install permissions on the computer in order to run the installer, and you must have IIS (Internet Information Services) permissions to install to the Web server.

  2. To access the Web application that was deployed, start Internet Explorer, and type the URL http://localhost/xyz. Note that the text on the button changes to "abc" when you click the button on the Web page.

To deploy the application to a Web server on another computer

  1. In Windows Explorer, navigate to your project directory and find the built installer. The default path will be \documents and settings\yourloginname\ My Documents\Visual Studio Projects\WebApp1\WebDeploy\project configuration\WebDeploy.msi. The default project configuration is Debug.
  2. Copy the WebDeploy.msi file and all other files and subdirectories in the directory to the Web server computer.
  3. On the Web server computer, double-click the Setup.exe file to run the installer.

    Note   You must have install permissions on the computer in order to run the installer, and you must have IIS permissions to install to the Web server.

  4. To access the Web application that was deployed, start Internet Explorer, and type the URL http://[ComputerName]/xyz. Note that the text on the button changes to "abc" when you click the button on the Web page.

To uninstall the application

  1. In the Windows Control Panel, double-click Add/Remove Programs.
  2. In the Add/Remove Programs dialog box, select WebApp1 and click Remove.
  3. Click OK to close the dialog box.

    Tip   To uninstall from your development computer, on the Project menu, choose Uninstall.

抱歉!评论已关闭.