次の方法で共有


How can I precompile my ASP.NET web pages so that the first user accessing the web site doesn’t experience slow performance?

Precompiling your ASP.NET web pages is a great way to increase the performance of your web site.  Once your web site has been precompiled, all of the content of your .ASPX, ASMX, ASAX, etc. files will be transformed into DLLs and placed in the "Bin" folder of your web site.

If you were to open one of these files after your web site has been precompiled, they would contain just one line that reads, “This is a marker file generated by the precompilation tool, and should not be deleted!”.

Precompiled Marker File

 

Aspnet_Compiler Command-line Example:

  • Aspnet_compiler –p c:\WebSiteFolder –v / C:\PrecompiledOutputFolder -f –fixednames

Aspnet_compiler Command-Line

 

Visual Studio 2005/2008 example using the Publish feature:

  • Right-click on your Web Site in Solution Explorer and click Publish Web Site
    • Uncheck the "Allow this precompiled site to be updatable" checkbox
    • Check the "Use fixed naming and single page assemblies" checkbox

 Visual Studio 2008 Publish Web Site

 

Note: The key things to remember when precompiling your web pages are to enable the use fixed names flag and disable the updatable flag.

 

For more information on deploying single ASP.NET web page to a web site that is precompiled:
https://blogs.msdn.com/perfworld/archive/2009/01/29/how-can-i-deploy-a-single-asp-net-web-page-to-a-web-site-that-is-precompiled.aspx 

For more information on the ASP.NET compilation tool:
https://msdn.microsoft.com/en-us/library/ms229863(VS.80).aspx