加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 在部署时编译ASCX文件而不是首次加载?

发布时间:2020-12-16 07:04:58 所属栏目:asp.Net 来源:网络整理
导读:当我将ASP.NET项目部署到包含许多ASCX文件的服务器时,第一页加载可能需要一段时间,大概是因为正在编译ASCX文件.虽然只编译了页面上实际的那些,但部署过程的一部分是导航到网站上的一堆页面.导航完所有页面后,网站运行顺畅. 我希望ASP.NET在部署时立即编译所
当我将ASP.NET项目部署到包含许多ASCX文件的服务器时,第一页加载可能需要一段时间,大概是因为正在编译ASCX文件.虽然只编译了页面上实际的那些,但部署过程的一部分是导航到网站上的一堆页面.导航完所有页面后,网站运行顺畅.

我希望ASP.NET在部署时立即编译所有这些ASCX文件,以删除这个草率部署步骤.

完成此任务的最佳方法是什么?

解决方法

听起来像你在寻找 ASP.NET Precompilation:

You can precompile a Web site project before it is made available to
users. This provides many advantages,which include faster initial
response time,error checking,source-code protection,and efficient
deployment. This is particularly important in large sites where there
are frequent changes in Web pages and code files.

You can also compile a project by using the Web application project model. In that model,all code files (standalone,code-behind,and class files) in the project are compiled into a single assembly and stored in the Bin directory. Because compilation creates a single assembly,you can specify attributes,such as assembly name and version. You can also specify the location of the output assembly if you do not want it to be in the Bin directory.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读