部署 ascx 控件
我已经修复了我的用户控件。
这些更改都存在于 .ascx
文件和 .ascx.cs
文件中。
现在,构建后...有什么方法可以为该控制容器部署我的...程序集...并避免部署 .ascx
文件?
I have a fix done for my user control.
The changes are there both in the .ascx
file and the .ascx.cs
file.
Now, post-build...is there any way I can deploy just my...assembly for this control container...and avoid the deployment of the .ascx
file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尽管程序集包含一些预编译方法,但每次请求页面时,
.ascx
页面仍然是“解释的”(从技术上讲,它是编译的,但 IMO 更容易将其视为解释的)(好吧,不是每次,因为它经常被缓存,但肯定是第一次进行更改)。亲自尝试一下 - 对.ascx
文件中的一些标记进行更改,然后请求该页面 - 您将看到您的更改反映在响应中(您可能必须如果已缓存,请重新启动该站点)。因此,接下来,您将需要部署这两个文件,因为 IIS 使用这两个文件来服务请求。
另一方面,当仅将单个程序集部署到实时站点时(或者可能只是我偏执,因为我认为这种情况发生在我身上一次)到实时站点时,有时可能会遇到奇怪的问题 - 立即部署整个站点更安全。与问题本身无关,但我想我会注意到它。
Although the assembly contains some pre-compiled methods, the
.ascx
page is still "interpreted" (technically it's compiled, but IMO it's easier to think of it as interpreted) every time the page is requested (well, not every time, since it's often cached, but certainly the first time changes are made). Try it for yourself -- make a change to some of the markup in a.ascx
file and then request the page -- you'll see that your changes are reflected in the response (you may have to restart the site if it's cached).So, following from this, you will need to deploy both of the files, as both are used by IIS to service a request.
On another note, you can sometimes run into strange problems when just deploying a single assembly (or maybe it's just me being paranoid because I thought this happened to me once) to a live site -- it's safer to deploy the entire site at once. Unrelated to the question itself, but I thought I'd note it.
否
..如果您在 .ascx 文件中进行了更改,您也应该上传该文件。no
.. if you have done change in the .ascx file you should upload that too..由于 ascx 文件已更改,并且它的标记代码不会进入控件的编译程序集,因此为了反映更改,您需要部署程序集(包含 ascx.cs 代码)和 ascx 文件。
Because the ascx file has changed and as it's markup code does not go into the compiled assembly of the control, for reflecting the changes, you'd need to deploy both the assembly (which contains the ascx.cs code) and the ascx file.