asp.net-mvc - 当站点部署在 IIS 上时,CKEditor 不工作

标签 asp.net-mvc asp.net-mvc-4 iis ckeditor bundle

我在 MVC 应用程序中使用 CKEditor。

我正在使用“ckeditor-full”(版本 4.4.2)包。

我已将“ckeditor\adapters\jquery.js”和“ckeditor\ckeditor.js”文件包含在 bundle 中,并在 _Layout.cshtml 文件中引用了这些 bundle 。

@Scripts.Render("~/bundles/Scripts/ckeditor")
@Scripts.Render("~/bundles/Scripts/ckeditor/adapters")

“Scripts/ckeditor”文件夹包含与包一起下载的所有 352 个文件。

以下是 config.js 文件(位于“Scripts/ckeditor”文件夹中。

CKEDITOR.editorConfig = function( config )
{
    // Define changes to default configuration here. For example:
    config.toolbar = 'Custom';
    config.disableNativeSpellChecker = false;
    config.browserContextMenuOnCtrl = true;
    config.forcePasteAsPlainText = true;

    config.toolbar_Custom = [
        { name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike', '-', 'RemoveFormat'] },
        { name: 'paste', items: ['PasteText'] },
        { name: 'links', items: ['Link', 'Unlink'] }
    ];
};

以下是我如何显示文本区域的 CKEditor:

$("#idBodyText").ckeditor();

问题是,如果在本地 IIS 上以 Debug模式运行,它在本地工作正常。但是,当使用发布配置部署在 IIS 上时,它不会显示 CKEditor。

知道可能的原因是什么以及如何解决这个问题吗?

非常感谢对此的任何帮助。

谢谢

最佳答案

作为一项解决方案,事实证明,在加载 bundle 之前,我必须在 View 中包含以下行 -

<script type="text/javascript">
    CKEDITOR_BASEPATH = "@Url.Content("~/Scripts/ckeditor/")";
</script>

关于asp.net-mvc - 当站点部署在 IIS 上时,CKEditor 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24503284/

相关文章:

c# - UserManager.CreateAsync .Success 总是返回 false

javascript - 使用 jquery 获取 <td> 中隐藏字段的值

asp.net - 有没有办法对ASP.NET开发Web服务器进行远程调用?

c# - 为什么 ASP.NET 页面在 IE 上呈现的速度比 Chrome 或 FF 快?

jquery - MVC 应用程序无法识别 Bootstrap Datetimepicker

iis - 迁移到 IIS 中的新 SSL 证书

asp.net - 在 aspnet mvc 成员资格中获取当前登录的用户 ID

mysql - MySQL 的 ASP.NET MVC 3 成员资格

javascript - 从客户端 js SPA 中的 web.config 读取 Api Key 值

asp.net-mvc - MVCContrib,Html.Grid : How can I attach a row-based id to a td tag?