部署 ascx 控件

发布于 2024-09-16 14:28:48 字数 157 浏览 6 评论 0原文

我已经修复了我的用户控件。
这些更改都存在于 .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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

柒夜笙歌凉 2024-09-23 14:28:48

尽管程序集包含一些预编译方法,但每次请求页面时, .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.

断爱 2024-09-23 14:28:48

..如果您在 .ascx 文件中进行了更改,您也应该上传该文件。

no .. if you have done change in the .ascx file you should upload that too..

且行且努力 2024-09-23 14:28:48

由于 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文