ASP.NET网页出版与复制? [英] ASP.NET WebSite Publishing vs. Copying?
问题描述
我也遇到了很多与出版的问题时,你需要在code小的变化,有时生成的DLL文件(例如 default.aspx.CS的dll文件像
公布时),无法通过IIS话说,codebehind是错了或什么的认可。对不起,我不记得确切的错误信息。我希望你明白我的意思是在这一点上。
I have faced a lot of issues with Publishing like when you need to make small changes on the code, sometimes the generated DLL file (the dll file for example of default.aspx.CS
when published) cannot be recognized by IIS saying the codebehind is wrong or something. Sorry for not remembering the exact error message. I am hoping you know what I mean at this point.
所以,我通常会做一个简单的复制粘贴
运行,而不是出版。
Therefore, I usually do a simple Copy Paste
operation instead of Publishing.
你能告诉我什么我不使用发布方法失踪?如何发布好?或者哪一个你preFER,为什么?
Could you tell me what am I missing by NOT using the Publish method? How is Publishing better? Or which one do you prefer, why?
基本上它是一个利弊的情况。
Basically its a pros and cons situation.
三江源
推荐答案
嗯,这取决于你的意思是复制是什么:
Well, it depends on what you mean by "copy":
使用发布
你有选择, pre-编译
全部或者应用程序的一部分。您可以发布
在你的文件系统中的本地文件夹(而不是你的目标/主机),然后的复制的更新的文件(S)(仅)。如果您正在(C#/ VB code)的变化的背后code,这意味着你可能只需要复制/覆盖的dll
。不用说,如果你做了内容的变化(HTML /剃须刀/脚本/等)的变化,那么你需要复制/覆盖那些为好。
With Publishing
you have options to pre-compile
all or part of your application. You can publish
to a local folder in your file system (instead of your target/host) and then copy the updated file(s) (only). If you are making "code behind" (c#/vb code) changes, this means you'll likely only need to "copy"/overwrite dlls
. Goes without saying that if you've made "content" changes (html/razor/script/etc) changes, then you'd need to copy/overwrite those as well.
如果您是新的部署,你会发现自己只是复制/覆盖一切的这是去的最安全的方式。一旦你获得更多的经验,你就会认识,它的资产,你只需要更新(一个或几个的dll
和或内容code,而不是一切)。没有什么神奇的这个,一般情况下,它只是在看DLL /文件的时间戳你公布之后的事
(本地)或重建
Web应用程序。
If you're new to deployment, you may find yourself simply copying/overwriting "everything" which is the safest way to go. Once you get more experience, you'll "recognize" which assets you only need to update (one or a few dlls
and or content code, instead of "everything"). There's no magic to this, usually, its a matter of just looking at the timestamp of the dll/file after you've published
(locally) or rebuild
your web application.
我建议你做一个本地发布
所以你可以看到什么是真正需要你的服务器上。发布到本地文件系统/文件夹中的文件是需要是你的主机/服务器上。这样做将可视化和消除任何神秘还有就是发布
:
I'd recommend doing a local publish
so you can see what is actually needed on your server. The files published to your local file system/folder is what needs to be on your host/server. Doing so will visualize and remove whatever "mystery" there is to Publishing
:
- 您会看到什么是真正需要(在服务器上)与什么不是
- 您会看到文件timesstamps这将帮助你认识到什么文件,实际上改变了VS那些没有(因此并不需要更新)。
- 一旦你得到了它的窍门,你就不用再复制/ ftp的一切,只是更新实际上是修改过的文件(只)。
所以,复制,意味着上述情况,或者如果你的意思是你会简单地复制所有开发code的(生(VB / CS)HTML / CS / VB
)到你的主机,那么这意味着你的网站将是动态编译
,因为需要每个资源/请求(没有什么是 pre-编译
)。也容易,但你失去了 pre-编译
这意味着有请求每个网页时的延迟/需要(ASP.net需要动态编译)。此外,您也露出了服务器上的源$ C $ C。它可能没有多大的意义根据您的情况,但它是一件事要考虑。
So "copy" can mean the above, or if you are saying you will simply copy all of your development code (raw (vb/cs)html/cs/vb
) to your host, then that means your site will be dynamically compiled
as each resource is needed/requested (nothing is pre-compiled
). Also "easy" but you do lose pre-compilation
which means there is a delay when each of your web pages are requested/needed (ASP.net needs to dynamically compile). Additionally, you are also exposing your source code on the server. It may not mean much depending on your situation, but it is one more thing to consider.
下面更上pre-编译信息和选项。
这篇关于ASP.NET网页出版与复制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!