Inserting image over 3mb via linq-to-sql

2019-08-26 06:38发布

New day, new problem :-)

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);
        }
    }

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; }
}

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, result); }

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

Thanks for help.

1条回答
姐就是有狂的资本
2楼-- · 2019-08-26 07:33

OK. I have found a solution:

link to solution:

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

查看更多
登录 后发表回答