多语言展示
当前在线:1392今日阅读:113今日分享:31

使用FastReport.Net的WCF服务的步骤

报表控件FastReport.Net使用FastReport.Service.dll库运用WCF服务的详细步骤如下
工具/原料
1

FastReport.Net

2

Visual Studio

事先工作
1

创建一个专门用于该测试的文件夹,该文件夹可以在磁盘的任意位置。

2

将FastReport.Service.dll,FastReport.Service.dll.config,FastReport.dll和FastReport.Bars.dll这4个文件复制到文件夹内。

3

创建两个子文件夹,分别用于存放数据和报表。

4

将FastReport 提供的示例数据库复制到数据文件夹内,该数据库一般存放在"\FastReport.Net\Demos\Reports\nwind.xml"中。

5

将\FastReports\FastReport.Net\Demos\WCF中的所有内容都复制到报表文件夹内,他报考了内置数据库连接的测试报表,简化测试过程。

6

在文本编辑器中打开配置文件:FastReport.Service.dll.config

7

节中更改报表路径。

8

节中的节点更改连接字符串。

9

创建service.bat文件,用以下内容。'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\WcfSvcHost.exe' /service:C:\WCF\FastReport\FastReport.Service.dll /config:C:\WCF\FastReport\FastReport.Service.dll.config

10

以管理员权限运行service.bat,然后WCF Service Host的图标就会出现在系统托盘中了,双击图标出现:

11

打开浏览器,输入地址http://localhost:8732/FastReportService/

12

如果出现以上内容,说明服务工作正常,在配置文件中也可以更改服务器端口。

连接服务
1

在Visual Studio中打开WCFServiceClient.csproj

2

在Service References–ReportService'点击右键,选择配置服务引用。

3

回到服务地址,地址应用以“/mex”结束(元数据交换)。

4

编译然后运行。

推荐信息