asp.net mvc - Time out 500 error on Edmx -


i developed website using asp.net mvc , edmx database , published website on azure , database on azure , i've functionality on website uploads excel record database , excel sheet contain 18000 records every time upload sheet throw timeout error after time should do.

enter image description here

initially not using command timeout after doing research i'm using in constructor

 public professionalservicesentities()         : base("name=professionalservicesentities")     {         this.database.commandtimeout = 10000;         //this.database.commandtimeout = 0; //i tried too.          //((iobjectcontextadapter)this).objectcontext.commandtimeout = 3600;     } 

here code of function :-

 public void saveequipments(ienumerable<equipsampleentity> collection)     {         using (professionalservicesentities db = new professionalservicesentities())         {             string modelxml = xmlserialization.listtoxml(collection.where(x=>x.type == model).tolist());             string accessoryxml = xmlserialization.listtoxml(collection.where(x => x.type == accessory).tolist());             db.importequipmentfile(modelxml, accessoryxml);         }     } 

here context file code sp:-

 public virtual int importequipmentfile(string modelxml, string accessoryxml)     {         var modelxmlparameter = modelxml != null ?             new objectparameter("modelxml", modelxml) :             new objectparameter("modelxml", typeof(string));          var accessoryxmlparameter = accessoryxml != null ?             new objectparameter("accessoryxml", accessoryxml) :             new objectparameter("accessoryxml", typeof(string));          return ((iobjectcontextadapter)this).objectcontext.executefunction("importequipmentfile", modelxmlparameter, accessoryxmlparameter);     } 

you may processing excel on upload , processing row row. have 2 options, 1 schedule background job pickup upload file , insert db , complete request.

next option read whole file in 1 go , single bulk insert db.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -