在本章中,我们将学习FastReport中使用 表的原则。我们还将仔细介绍如何使用FastReport.Service.dll创建Web服务。
Fastreport.NET在线购买价更低,专享85折起!赶紧加入购物清单吧!
使用FastReport .Net提供的库FastReport.Service.dll(WCF服务库)实现 络服务有一个简单的方法。
我们的例子是基于创建一个具有web服务功能的简单web应用程序,但您可以基于.NET Framework 4.0或更高版本修改您现有的项目。
运行Visual Studio并在.NET Framework 4.0下创建一个新的ASP.NET Web应用程序项目。


<%@ ServiceHost Service="FastReport.Service.ReportService" %><%@ Assembly Name="FastReport.Service" %>
打开web.config,在<配置>部分添加这段代码。
<appSettings><!-- path to folder with reports --><add key="FastReport.ReportsPath" value="C:ProgramfilesFastReportsFastReport.NetDemosWCF" /><!-- 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:ProgramFilesFastReportsFastReport.NetDemosReportsnwind.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.NetDemos/WCF”。例如,你可以将其设置为演示文件夹”FastReport.NetDemosWCF”。
键 “FastReport.ConnectionStringName “应该包含连接字符串名称。这一行应该在<connectionStrings>部分注册。
让我们运行我们的 站,通过访问文件ReportService.svc来检查Web服务的可用性。

客户端程序的例子可以在文件夹 FastReport.Net/Demos/C#/WCFClient 和 FastReport.Net/Demos/C#/WCFWebClient 中找到。在Visual Studio中打开每个项目,右击ReportService,在弹出的对话框中选择配置服务参考。
在配置窗口中指定现有Web服务的地址。
还想要更多吗可以点击阅读【FastReport 表2020最新资源盘点】,查找需要的教程资源。让人兴奋的是FastReport .NET 表正在 火热销售中!低至3701元起!>>查看价格详情
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!