C#-vs Publishing Web site

Source: Internet
Author: User

Generate a publish file in VS

Now that you have a website, you can publish it. You can publish a Web site to any location that you can access by using any of the connection agreements that Visual Studio supports. There are several ways to copy a Web site:

    • Copy to a folder on the local computer.

    • Use a UNC share to replicate to a shared folder on another computer on the network.

    • Use FTP to copy to the server.

    • Use the HTTP protocol to replicate to a server that has the FrontPage Server Extensions (FPSE) installed.

In this part of the walkthrough, you will publish the Web site to a local folder.

Publishing Web Sites
  1. On the Build menu, click Publish Web site.

    The Publish Web Site dialog box appears.

  2. In the Target Location box, enter C:\CompiledSite.

    Warning

    All data in the destination folder and its subfolders will be deleted.

    For this walkthrough, you will publish to a local folder. If you want to publish to a remote Web site using HTTP or FTP, you need to specify the URL of the remote server in the target Location box.

  3. Clear "Allow this precompiled site to be updated."

    This option specifies that all program code is compiled into an assembly, but pages and user controls (. aspx,. ascx, and. master files) are copied to the destination folder as-is, and can be updated as a text file without precompiling the project. in this walkthrough, you will not select this option. For more information, see ASP. NET site project Deployment Overview.

  4. Click OK.

    Visual Studio precompiled the content of the Web site and writes the output to the specified folder. The Output window displays progress messages. If an error occurs at compile time, the error is reported in the Output window.

  5. If an error occurs during the publishing process, fix the errors, and then repeat the process.

Check the output of the Publish Web site command

It is useful to see the output of the Publish Web site command so you can see what Visual Studio does with your Web site files.

Check the output of the Publish Web site command
    1. Open with a text editor such as Notepad SamplePage.aspx file.

      Note that the original tag is not included in the file. instead, the. aspx page is just a placeholder that can be used as part of the URL.

    2. move to the Bin folder.

      • .compiled file, corresponding to the page.

      • .dll files, such as the class file that you created, Contains the executable code for the Web site.

The page, page code, and individual class files that you created have been compiled into executable code.

Test the published Web site

You can now test the site by running the published Web site.

Set up IIS for the server
  1. Create an IIS virtual directory that points to the destination folder.

    1. From the Windows Start menu, choose Run, enter Inetmgr, and then click OK.

      The Internet Information Services (IIS) Manager dialog box appears.

    2. In the Connections pane, expand the server name, and then expand Sites.

    3. Right-click Default Web site, and then select Add Virtual directory.

      The Add Virtual Directory dialog box appears.

    4. In the Alias box, enter Compiledwebsite.

    5. In the Physical Path box, enter C:\CompiledWebSite.

    6. Click OK.

    7. In IIS Manager, in the Connections pane, right-click the new virtual directory, and then select Convert to Application.

      The Add Application dialog box appears.

    8. Click OK.

  2. Open the browser and type the following URL:

    Http://localhost/CompiledSite/SamplePage.aspx

    The SamplePage.aspx page appears. However, this time you are looking at the version of the page that the precompiled compiler created for deployment.

Next steps

This walkthrough demonstrates the basic process of publishing a precompiled Web site. areas for further study include:

    • Try using the Copy Web Site tool instead, which copies the site as-is (by source) to the destination folder. For more information, see Deploying Web Site projects by using the Copy Web Site tool.

    • Publish the Web site to a remote IIS Web site.

C#-vs Publishing Web site

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.