首先,设置:
服务器:Ubuntu 10.04 服务器
mongod--版本
db版本v1.2.2,pdf文件版本4.5
11 月 23 日星期三 11:35:42 git 版本:nogitversion
客户端:Windows 7 64bit,VS2010 app,使用官方C#驱动v1.3。
我正在尝试使用 GridFS 在 mongoDB 中存储 png 图像。我的代码如下所示:
var GridFSInfo = DB.GridFS.Upload(TextureFileName, TextureFileName);
运行此代码我得到以下异常
An unhandled exception of type 'MongoDB.Driver.GridFS.MongoGridFSException' occurred in MongoDB.Driver.dll
Additional information: Upload client and server MD5 hashes are not equal.
我试图查找有关此错误的信息,但我似乎是唯一遇到此问题的人:(
服务器日志没有给出任何错误,我得到的只是:
Wed Nov 23 11:42:23 connection accepted from 141.3.89.168:16861 #159
Wed Nov 23 11:42:25 building new index on { _id: ObjId(000000000000000000000000) } for ObjectDBTest.fs.files...
Wed Nov 23 11:42:25 Buildindex ObjectDBTest.fs.files idxNo:0 { name: "_id_", ns: "ObjectDBTest.fs.files", key: { _id: ObjId(000000000000000000000000) } }
Wed Nov 23 11:42:25 done for 0 records 0secs
Wed Nov 23 11:42:25 info: creating collection ObjectDBTest.fs.files on add index
Wed Nov 23 11:42:25 building new index on { filename: 1, uploadDate: 1 } for ObjectDBTest.fs.files...
Wed Nov 23 11:42:25 Buildindex ObjectDBTest.fs.files idxNo:1 { _id: ObjId(4ecccd0382522c02f8e58d75), name: "filename_1_uploadDate_1", ns: "ObjectDBTest.fs.files", key: { filename: 1, uploadDate: 1 } }
Wed Nov 23 11:42:25 done for 0 records 0secs
Wed Nov 23 11:42:25 building new index on { _id: ObjId(000000000000000000000000) } for ObjectDBTest.fs.chunks...
Wed Nov 23 11:42:25 Buildindex ObjectDBTest.fs.chunks idxNo:0 { name: "_id_", ns: "ObjectDBTest.fs.chunks", key: { _id: ObjId(000000000000000000000000) } }
Wed Nov 23 11:42:25 done for 0 records 0secs
Wed Nov 23 11:42:25 info: creating collection ObjectDBTest.fs.chunks on add index
Wed Nov 23 11:42:25 building new index on { files_id: 1, n: 1 } for ObjectDBTest.fs.chunks...
Wed Nov 23 11:42:25 Buildindex ObjectDBTest.fs.chunks idxNo:1 { _id: ObjId(4ecccd0382522c02f8e58d76), name: "files_id_1_n_1", ns: "ObjectDBTest.fs.chunks", key: { files_id: 1, n: 1 }, unique: true }
Wed Nov 23 11:42:25 done for 0 records 0secs
Wed Nov 23 11:42:29 end connection 141.3.89.168:16861
在我看来,这就像文件传输已启动,但随后出现问题。我三次检查该文件是否存在。我使用 mongofiles 命令行实用程序来查看 GridFS 是否正常工作并且那里一切正常,文件上传没问题。如果我不进行 GridFS 上传并且只使用标准 BSON 文档操作,我的应用程序也可以正常工作。我可以很好地插入、搜索、删除,因此与服务器的连接正常。
我现在不知道这可能是什么来源。我会感谢任何提示。