FastReport报表,FastReport报表加载不出来
插件链接:
FastReport.Net软件地址:https://pan.baidu.com/s/1c2kNBVi
使用方法:
第一步:添加引用
FastReport.Bars.dll
FastReport.dll
FastReport.Web.dll
dll包:http://pan.baidu.com/s/1pKJwXoZ
第二部:配置config
1、View文件夹内配置web.config文件,添加两个引用
2、网站配置文件web.config添加节点httphandlers
iis6: <httpHandlers> <add path="FastReport.Export.axd" verb="*" type="FastReport.Web.Handlers.WebExport" /> </httpHandlers> iis7: <handlers> <add name="FastReportHandler" path="FastReport.Export.axd" verb="*" type="FastReport.Web.Handlers.WebExport"/> </handlers>
第三部:控制器代码
1、视图
@WebReportGlobals.Scripts()
@WebReportGlobals.Styles()
@ViewBag.WebReport.GetHtml()
2、控制器
private WebReport webReport = new WebReport(); public ActionResult Index() { SetReport(); webReport.Width = 600; webReport.Height = 800; webReport.ToolbarIconsStyle = ToolbarIconsStyle.Black; ViewBag.WebReport = webReport; return View(); } private void SetReport() { string report_path = AppDomain.CurrentDomain.BaseDirectory; //传递数据 webReport.Report.RegisterData(new List<object> { new { Type = "Type", Mobile = "mobile", Price = "price", Date = "date", Title = "title", Ad = "ad" } }, "Orders"); //调用模板 webReport.Report.Load(report_path + "order.frx"); }
错误:
FastReport报表加载不出来并且报404错误:
解决方案:
当前项目->属性->Web->服务器->选中单选【使用Visual Studio 开发服务器】