private Stream GetFile(string xml) { MessageList mes_list = new MessageList(); MessageLog logs = new MessageLog(MessageLog.INFO, "GetFile", "Создание потока"); mes_list.Add_Message(logs); XDocument doc = XDocument.Parse(xml); FRDataForm form = new FRDataForm(); ConverterClass convert_class = new ConverterClass(); List <DataTable> list = convert_class.Converter(doc, out form); using (Report report = new Report()) { //conf.GetValue("FolderFR") "\\Report\\" String name_file = conf.GetValue("PathService") + "\\" + conf.GetValue("FolderFR") + "\\" + form.product + "\\" + form.form + ".frx"; MemoryStream mem = new MemoryStream(); logs = new MessageLog(MessageLog.INFO, "GetFile", "Отчет " + name_file); mes_list.Add_Message(logs); ExportBase export = Format(form); report.Load(name_file); EnvironmentSettings s = new EnvironmentSettings(); s.ReportSettings.ShowProgress = false; foreach (DataTable st in list) { report.RegisterData(st, st.TableName); } //report.Show(); //report.Design(); report.Prepare(); //FileStream fl = new FileStream("555.pdf", FileMode.Create); //report.Export(export, fl); //fl.Close(); //report.SavePrepared(fl); report.Export(export, mem); // } // nt.Flush(); mem.Position = 0; //byte[] file = mem.ToArray(); logs = new MessageLog(MessageLog.INFO, "GetFile", "Отчет сформирован и отправлен"); mes_list.Add_Message(logs); Logger.getInstance().Write(mes_list); return(mem); } }
private void Initializer(ConfigClass conf) { TimeOutLogEmpty = Convert.ToInt32(conf.GetValue("TimeOutLogEmpty")); String addr = "http://" + conf.GetValue("ServiceHost") + ":" + conf.GetValue("ServicePort") + "/" + conf.GetValue("ServiceAddress"); Uri uri = new Uri(addr); var rt = new FastReportDLL.WCF.FastReportWCF(conf); serviceHost = new ServiceHost(rt, uri); //serviceHost = new ServiceHost(typeof(FastReportDLL.WCF.FastReportWCF), uri); BasicHttpBinding binding = new BasicHttpBinding(); binding.MessageEncoding = WSMessageEncoding.Mtom; TimeSpan times = new TimeSpan(0, 5, 0); binding.CloseTimeout = times; binding.OpenTimeout = times; binding.ReceiveTimeout = times; binding.SendTimeout = times; binding.MaxReceivedMessageSize = int.MaxValue; binding.MaxBufferSize = int.MaxValue;// 2147483647; serviceHost.CloseTimeout = times; serviceHost.OpenTimeout = times; serviceHost.AddServiceEndpoint(typeof(FastReportDLL.WCF.IFastService), binding, ""); ServiceMetadataBehavior behavior = new ServiceMetadataBehavior(); behavior.HttpGetEnabled = true; serviceHost.Description.Behaviors.Add(behavior); ServiceThrottlingBehavior stb = new ServiceThrottlingBehavior { MaxConcurrentSessions = Convert.ToInt32(conf.GetValue("MaxConcurrentSessions")), MaxConcurrentCalls = Convert.ToInt32(conf.GetValue("MaxConcurrentCalls")), MaxConcurrentInstances = Convert.ToInt32(conf.GetValue("MaxConcurrentInstances")) }; serviceHost.Description.Behaviors.Add(stb); if (conf.GetValue("ServiceMEX_IS").Equals("Да")) { serviceHost.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(), "mex"); } }