Inserting an image via 3mb via linq-to-sql
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; }
}
Problem: When I try to save blobs with Content less than 3mb it works fine, but when blob exceeds 3mb I get a "Not Found" exception (---> error line) in the 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 this. I have set in web.config the appropriate buffer sizes, but it doesn't work yet.
Thanks for the help.
0
source to share