The. NET Visual Studio Publishing site allows you to update this precompiled site && use a fixed-named and single-page assembly

Source: Internet
Author: User

① allow this precompiled site to be updated

We can publish VS2008 's website in the following way: "Generate" → "publish website"; pop-up dialog box! In the dialog box that opens, one option is critical, which is "allow this precompiled site to be updated";

"Allow this precompiled site to be updated", by default, the preceding is a √, as to whether to hit the last √, is optional, then, tick and do not tick, what is the difference?

Perhaps everyone has published net website, generally, the website project of all CS files, will automatically generate a DLL dynamic link library, which can be good protection of the source code of the site, because the code is generally placed in the CS file, since all generated DLL files, then upload to virtual space, No one else can open it and see it!

However, other files, such as Ashx, ASPX, and so on, what's in it, what it is, others can open these files to view, although others can't see the CS code, but still can see the ASPX file inside the HTML code or some server control and related properties;

Also, ashx such a file, the equivalent of a CS file, the inside of the code is also able to see. Therefore, the CS file is safe, but the Web site of ASPX, asxh and other files, is not safe, for the entire site, only local security, but not the overall security.

So, is there a way to make the Web files uploaded to the virtual space safe? Method is available, through the "allow updates to this precompiled site" before the first √, can be achieved;

① to "Allow this precompiled site to be updated" √

If you give this tick and then publish the website, then, the result is this, the whole site file, in addition to all the CS files compiled into a DLL file, other files, and the original without any changes, what is inside, or what, as long as someone else through Notepad open, inside the code, HTML code, etc. , you can make others glance.

In addition, the website published in this way, when the user first visit a page, need to be compiled, to find the bug, then, if there is no error, to normal access, so the speed will become slower. (Second and third time ...) Access, the speed is normal)

② Cancel "Allow updates to this precompiled site" before the Yes

If you cancel the check in front of "allow updates to this precompiled site" When you publish the site, the result is this:

1, the site of all CS files, are compiled into a DLL file;

2, in addition to CS files, other files, such as ASPX, ashx and other files, also compiled together, each file in the Bin directory to generate a corresponding *.compiled file;

Then, if you view the ASPX, ashx and other files through Notepad, you will not see any code, even the HTML code tags are not visible, open such a file, there is only one line of text, the content is "This is the precompiled tool generated markup files, should not be deleted!"

However, the site's access is normal, and there will be no bad problems.

So, using this way to publish a website, what file can not be opened through Notepad, it is displayed in a line of text, therefore, the site file is very safe.

In addition, the website published by this method, all the content has been compiled, the speed of opening is very fast.

② using fixed-named and single-page assemblies

By default, when publishing a Web site, ASP. NET uses the batch compilation feature to compile the Web site: The compiler merges the output of multiple source files in each folder into a single assembly per folder. The compiler determines which source outputs to merge based on a variety of factors, including dependencies between source files. Batch compilation assigns the generated name to the resulting assembly, and the Assembly does not map directly to the original source file. With the batch compilation feature, the assembly name will be regenerated each time the site is published.

If you want to publish only updates to specific parts of the site without redeploying the entire site, the assemblies created by the batch compilation may not be suitable for this site. In this case, it may be more convenient to use an assembly that is mapped to the source file one-to-one and has a predictable name. When you publish an ASP. NET Web site in Visual Web Developer, you can choose to generate a fixed file name for a single-page assembly, which is a compiled assembly, and each single-page assembly corresponds to a single page or user control (that is,. aspx,. ascx, and. master files). The fixed file name option also preserves the name of the assembly when you compile and publish the Web site. When a fixed file name is used for a single-page assembly, the batch compilation feature is turned off for precompilation. (Theme and skin files, and other folders that do not contain pages or user controls, will continue to be compiled into a single assembly.) When you choose to generate a fixed assembly name, ASP. NET performs the following actions:

Create an assembly for each. aspx,. ascx, and. master file in your application. You should limit the number of pages in your application to reduce the amount of assemblies that are generated. Use the virtual path of the page as the name of the Assembly for the page. If the virtual path length exceeds the operating system's file name length limit, the tool will use a hash of the virtual path instead. As with batch compilation, the files in the top-level directory (such as the App_Code directory) are compiled into a single assembly.

The. NET Visual Studio Publishing site allows you to update this precompiled site && use a fixed-named and single-page assembly

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.