打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
使用FastReport.Service.dll创建Web报表服务
最新版本的FastReport .Net推出了WCF服务库——FastReport.Service.dll,所以现在给大家介绍一个更简单的方法实现Web报表服务。

  使用.NET Framework 4.0或以上版本,就可以在现有项目技术上进行非常简单的修改,实现建立在Web服务基础上的Web报表应用了。接下来介绍一下通用的使用步骤。

1、.NET Framework 4.0下打开Visual Studio并创建一个新的ASP.NET Web Application的项目。

2、添加引用库FastReport.dll,FastReport.Bars.dll,FastReport.Service.dll。

3、在站点根目录上创建一个名为ReportService.svc的文笔文件。

4、在文本中增加以下代码:

5、打开web.config,在<configuration>节中增加以下代码:

<appSettings><!-- path to folder with reports --><add key="FastReport.ReportsPath" value="C:\Program files\FastReports\FastReport.Net\Demos\WCF" /><!-- name of connection string for reports --><add key="FastReport.ConnectionStringName" value="FastReportDemo" /><!-- Comma-separated list of available formats PDF,DOCX,XLSX,PPTX,RTF,ODS,ODT,MHT,CSV,DBF,XML,TXT,FPX.You can delete any or change order in this list. --><add key="FastReport.Gear" value="PDF,DOCX,XLSX,PPTX,RTF,ODS,ODT,MHT,CSV,DBF,XML,TXT,FPX" /></appSettings><connectionStrings><add name="FastReportDemo" connectionString="XsdFile=;XmlFile=C:\Program Files\FastReports\FastReport.Net\Demos\Reports\nwind.xml"/></connectionStrings><system.serviceModel><services><service behaviorConfiguration="FastReportServiceBehavior" name="FastReport.Service.ReportService"><endpoint address="" binding="wsHttpBinding" contract="FastReport.Service.IFastReportService"><identity><dns value="localhost" /></identity></endpoint><endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /></service></services><behaviors><serviceBehaviors><behavior name="FastReportServiceBehavior"><serviceMetadata httpGetEnabled="True" /><serviceDebug includeExceptionDetailInFaults="True" /></behavior></serviceBehaviors></behaviors><bindings><basicHttpBinding><binding messageEncoding="Mtom"closeTimeout="00:02:00" openTimeout="00:02:00"receiveTimeout="00:10:00" sendTimeout="00:02:00"maxReceivedMessageSize="67108864" maxBufferSize="65536"transferMode="Streamed"><security mode="None"><transport clientCredentialType="None" /></security></binding></basicHttpBinding></bindings></system.serviceModel>

注意:FastReport.ReportsPath是报表文件夹的路径,本示例中的路径是“\FastReport.Net\Demos\WCF”

FastReport.ConnectionStringName是连接字符串名称,应在<connectionStrings>中注册。

6、运行站点,来检查Web服务的可用性,出现以下页面便运行成功。

注意:在服务器上部署项目时,FastReport.dll,FastReport.Bars.dll,FastReport.Service.dll要在/ bin文件夹中。

Web服务连接成功后,就在可以在Visual Studio中打开现有项目,点击ReportService选择Configure Service Reference设置就行了。

  最后把用到的FastReport .Net的Visual Studio 2013的下载放出来,VS2013真的很不错啊。

  FastReport .Net最新版本 下载>>

  Visual Studio 2013  下载>>

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
FastReport创建托管在windows服务中的WCF服务
如何:启用 WCF 身份验证服务
Web Service开发指南
跨平台的可视化Web报表设计器—FastReport Online Designer 发布啦
强大的服务器报表引擎控件FastReport server介绍
FastReport复合报表
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服