Fckeditor XML Request error:internal server error (500) 一例

  最近编写一个文章管理系统,参考了网络上的一些经验。感觉重新开始学习网页编程,差距真是太大了。想2000年前后,曾经学习过html、perl、php、asp、JS、VBS,后来还学习过jsp等,数据库用过access、mssql、mysql,后来学过oracle等。如今再拾起来,总是有些似曾相识,但毕竟不是一回事了。
  现在开始学习aspx,发现如果想学好一种语言,说起来容易,其实想真正掌握,也绝非易事。如果没有扎实的基础,总会感觉难以得心应手。
  文章管理系统中用到了fckeditor上传文件,在本机编译运行还是好好的,可是到了win2003服务器上就不能正常运行了。提示FCKeditor : XML Request error:internal server error (500) 。因为设置成了独立的域控制器,找了半天的资料,按所有的要求做了,足足有四、五天,还是不行。后来没有办法只好安装成独立服务器,一试行了,也可能当时没有弄清。接着按单位的要求加入域,第二天再一试,又不行了,真是无可奈何。
  实在没有办法了,只好从头找起。把其中的test.html复制回去,测试结果原来是引用的FredCK.FCKeditorV2.dll出了问题,真是没有想到。提示Util.CreateDirectory()出现错误。找到FredCK.FCKeditorV2.dll的源代码中的Util.cs,发现其中有一段为:
  // The "_mkdir" function is used by the "CreateDirectory" method.
  [DllImport("msvcrt.dll", SetLastError=true)]
  private static extern int _mkdir(string path) ;
由此想到可能是系统的这个msvcrt.dll不一致造成程序调用出错,查看后发现版本确实不一样,服务器是win2003 sp1的,究竟是不是加入域后访问规则的改变,还没有找到是什么原因。
  仔细阅读了源代码,把其中涉及到msvcrt.dll的去除不用,替换成Directory.CreateDirectory(),编译后把FredCK.FCKeditorV2.dll复制到文章管理系统的bin目录,运行正常,win2003 sp1中也正常。
  源代码中也说明,如果直接使用System.IO.Directory.CreateDirectory()会出现异常提示,不过它当时是使用vs2003开发的,而vs2005中没有出现异常提示,可以正常使用。
  由于fckeditor涉及的语言较多,只能先这样修改,凑乎着用吧。
  修改后的Util.cs参考源代码:

using System ;
using System.Runtime.InteropServices ;
using System.IO ;
using System.Collections ;

namespace FredCK.FCKeditorV2
{
 public sealed class Util
 {
  private Util()
  {}

  public static DirectoryInfo CreateDirectory( string path )
  {
            Directory.CreateDirectory(path);           
            return new DirectoryInfo(path);  }
 }
}

posted on 2007-09-20 09:36  Mossan  阅读(3531)  评论(3编辑  收藏  举报