本文介绍了通过LINQ到SQL插入图像超过3MB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新的一天,新的问题: - )

New day, new problem :-)

code:
客户端:

Code:
Client Side:

void abw_Closed(object sender, EventArgs e)
{
    DbServiceClient sc = new DbServiceClient();
    abw = (AddBlobWindow)sender;
    fi = ((AddBlobWindow)sender).fi;
    if ((bool)((AddBlobWindow)sender).DialogResult)
    {
        blob = new Blob();
        binBlob = new Binary();
        binaryBlob = new byte[fi.Length];

        int n = fi.OpenRead().Read(binaryBlob,0,Convert.ToInt32(fi.Length));

        binBlob.Bytes = binaryBlob;
        blob.Content = binBlob;
        blob.Signature = abw.tbSignature.Text;
        blob.Size = (int)fi.Length;

        sc.SaveBlobCompleted += new EventHandler<AsyncCompletedEventArgs>(sc_SaveBlobCompleted);
        sc.SaveBlobAsync(blob);
        }
    }

服务器端的服务code:

Server side service code:

[OperationContract]
public void SaveBlob(Blob blob)
{
    try
    {
        RichTekstModelDataContext dc = new RichTekstModelDataContext();
        dc.Blobs.InsertOnSubmit(blob);
        dc.SubmitChanges();
    }
    catch (Exception ex) { string s = ex.Message; }
}

问题:当我试图挽救斑点与内容较场3MB它完美较小,但是当一滴exceedes 3 MB,我得到未找到的异常(--->错误线)Refernece.cs文件

The problem:When I am trying to save blobs with Content field smaller than 3mb it works perfectly, but when blob exceedes 3 mb, I am getting "Not found" exception (---> error line) in Refernece.cs file

public void EndSaveBlob(System.IAsyncResult result) {
    object[] _args = new object[0];

----> base.EndInvoke(SaveBlob,_args,结果);    }

----> base.EndInvoke("SaveBlob", _args, result); }

我不知道如何解决它。我已经设置在web.config中apropriate缓冲区的大小,但还是老样子这是行不通的。

I have no idea how to fix it. I have set in web.config apropriate buffers sizes, but stil it doesn't work.

感谢您的帮助。

推荐答案

确定。我已经找到了解决办法:

OK. I have found a solution:

链接的解决方案:

http://silverlight.net/forums/p/18162/61547.aspx

这篇关于通过LINQ到SQL插入图像超过3MB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 00:05