如何为报表开发工具 FastReport .NET 设置 Apache 2 Web 服务器?

FastReport .NET是一款全功能的Windows Forms、ASP.NET和MVC报表分析解决方案,使用FastReport .NET可以创建独立于应用程序的.NET报表,同时FastReport .Net支持中文、英语等14种语言,可以让你的产品保证真正的国际性。专业版和企业版包括FastReport的所有源代码,你可根据自己的特殊需求调整产品,并完全控制所有软件代码,保障报表的绝对安全。

FastReport.NET官方版下载icon-default.png?t=N176https://www.evget.com/product/1861/download

众所周知, FastReport .NET 是一款强大的报表开发工具,它支持与 Apache 2 Web 服务器集成。本次我们进行的就是 Apache 2 在 Linux 操作系统上的微调。

首先,我们需要使用一些命令安装 .NET 5,从 Microsoft 存储库下载必要的包:

$ wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
$ sudo dpkg -i packages-microsoft-prod.deb

接下来,我们来安装 .NET5 包:

sudo apt-get update; \
sudo apt-get install -y apt-transport-https && \
sudo apt-get update && \
sudo apt-get install -y dotnet-sdk-5.0 

注意:你可以开始安装FastReport.Core.Skia包,并将此项目发送给已经在Ubuntu上的你。
通过测试安装,你不需要X11来使应用程序正常工作,因为它已经和apache或在Ubuntu上安装了。
现在让我们用以下命令开始加载Apache2。

sudo apt install apache2

如果成功,就可以继续下一步。接下来,我们将管理 Apache 服务或其重启和关闭。请记住,对于 Apache 中的任何更改,例如,更改配置或启用任何设置时,您将需要运行以下命令:

sudo systemctl start apache2 — Starts a previously stopped web server
sudo systemctl restart apache2— Stops and restarts the web server

Apache 配置为在服务器启动时自动启动。如果您不想这样做,请使用以下命令禁用它:

sudo systemctl disable apache2

要在引导期间重新加载启动服务,请输入:

sudo systemctl enable apache2

现在我们需要设置虚拟主机,意味着如果转到 localhost:80,将被自动重定向到 localhost:5000。

为了工作能正常进行,有必要启用一些模块:

sudo a2enmod proxy
sudo a2enmod proxy_http

接下来,转到安装 Apache 时自动创建的文件夹:

sudo cd /etc/apache2/sites-available/ 

现在用配置创建一个文件并立即编辑它:

sudo nano /etc/apache2/sites-available/your_domain.conf 

您需要将下行添加到文件中:


ProxyPreserveHost On
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
ErrorLog ${APACHE_LOG_DIR}helloapp-error.log
CustomLog ${APACHE_LOG_DIR}helloapp-access.log common

注意:如果转到 localhost:80,那么将被自动重定向到 localhost:5000

创建配置文件后,激活它并禁用默认配置:

sudo a2ensite your_domain.conf —Activate your config 
sudo a2dissite 000-default.conf — Disable the config by default
sudo apache2ctl configtest — Check the file for syntax errors (if it is ok, then you will see the "Output Syntax OK" notification in the console) 
sudo systemctl restart apache2 —Restart Apache for the changes to take effect 

要发布项目,您将需要以下命令:

dotnet publish --configuration Release — Publish the application to the publish folder as a release 

接下来,转到发布文件夹。您将使用 ls 命令看到所有带有项目名称的 dll。

该项目使用以下命令启动:

dotnet FastReport.Core.Web.Net5.dll

使用之前启动的 FastReport.Core.Web.Net5 应用程序重新启动 Apache,并转到 Apache 中指定的虚拟主机。即在 localhost:80 上,看到它自动重定向到 localhost:5000。

如果成功的话,那么恭喜!您已经为 FastReport .NET 成功配置了 Apache 2。

你可能感兴趣的:(软件资讯,干货分享,软控件相关,报表工具,FastReport,报表控件,报表分析,报表设计器)