【发布时间】:2016-03-11 13:26:23
【问题描述】:
谁能帮我发布 Kentico CMS 9。当我从 Visual Studio 发布应用程序并上传到服务器时,我收到了这个异常:
当我从计算机中的开发者文件夹上传文件到同一个虚拟主机时,一切都运行良好。
你能帮帮我吗?
【问题讨论】:
标签: kentico
谁能帮我发布 Kentico CMS 9。当我从 Visual Studio 发布应用程序并上传到服务器时,我收到了这个异常:
当我从计算机中的开发者文件夹上传文件到同一个虚拟主机时,一切都运行良好。
你能帮帮我吗?
【问题讨论】:
标签: kentico
问题在于解决方案中的两个项目中仅发布一个。
来自 Kentico 9 发布文档:
发布 Web 应用程序项目 如果您计划从 Visual Studio 发布,我们建议使用网站配置安装 Kentico 项目。 要使用 Visual Studio for Kentico Web 应用程序项目的发布功能,您需要将解决方案中的所有项目按顺序发布到同一目标位置: CMSApp CMSApp_AppCode 部署第一个项目后,请确保您的发布配置文件已禁用发布前删除所有现有文件/在目标位置删除其他文件选项。您可以在 Settings -> File Publish Options 的 Publish Web 对话框中配置该选项。
【讨论】:
这可能是一个未内置的错误,Kentico 9 仍然是新的,因此您可能希望将其记录为错误。
否则,虽然我相信在启动时的某个地方,您确实需要使用 WebFarmHelper.RegisterTask 注册农场任务,也许您可以尝试使用自定义加载器模块在启动时添加该代码。
https://docs.kentico.com/display/K9/Handling+global+events
using CMS.Base;
using CMS.DocumentEngine;
[CustomDocumentEvents]
public partial class CMSModuleLoader
{
/// <summary>
/// Attribute class that ensures the loading of custom handlers.
/// </summary>
private class CustomDocumentEventsAttribute : CMSLoaderAttribute
{
/// <summary>
/// The system executes the Init method of the CMSModuleLoader attributes when the application starts.
/// </summary>
public override void Init()
{
// Call WebFarmHelper.RegisterTask here
}
}
}
【讨论】:
谢谢大卫·斯拉维克。 如您所说,首先发布 CMSApp_AppCode,然后在同一文件夹中发布 CMSApp,但请注意禁用“发布前删除所有现有文件”选项。
【讨论】: