更新配置文件#
在安装凯睿德MES期间,可安装安全门户并将其设置为禁用状态。在这种情况下,安全门户仍安装在环境中,但未启用。要启用安全门户,您需要按照本文档中定义的步骤操作。
为了启用安全门户,需要更新环境中存在的一些Web.config文件。
Note
以下步骤中给出的文件路径假设您位于安装了凯睿德MES的磁盘文件夹中。例如,如果凯睿德MES已安装在文件夹C:\Program Files\CriticalManufacturingSystem中,并且本文档要求更改文件UI\api\Web.config,则要更改的文件是位于C:\Program Files\CriticalManufacturingSystem\UI\api\Web.config中的文件。
用户界面配置文件#
UI\api\Web.config#
请打开文件UI\api\Web.config。在该文件中,应该有一个具有以下服务器变量且名为api的规则:
<serverVariables>
<!--<set name="CMF_ALLOW_UNAUTHENTICATED" value="True" />-->
</serverVariables>
请删除该文件中的备注。该文件现在应该具有以下服务器变量定义:
<serverVariables>
<set name="CMF_ALLOW_UNAUTHENTICATED" value="True" />
</serverVariables>
保存并关闭文件。
UI\discoveryservice\Web.config#
文件UI\discoveryservice\Web.config的更新方式需要与以前的UI\api\Web.config文件相同。也就是说,规则api的服务器变量需要从:
<serverVariables>
<!--<set name="CMF_ALLOW_UNAUTHENTICATED" value="True" />-->
</serverVariables>
更改为
<serverVariables>
<set name="CMF_ALLOW_UNAUTHENTICATED" value="True" />
</serverVariables>
保存并关闭文件。
UI\messagebus\Web.config#
文件UI\messagebus\Web.config的更新方式需要与以前的UI\api\Web.config文件相同。即,规则api的服务器变量需要将以下内容:
<serverVariables>
<!--<set name="CMF_ALLOW_UNAUTHENTICATED" value="True" />-->
</serverVariables>
更改为
<serverVariables>
<set name="CMF_ALLOW_UNAUTHENTICATED" value="True" />
</serverVariables>
保存并关闭文件。
UI\reportingservices\Web.config#
请打开文件UI\reportingservices\Web.config。在该文件中,应该有一个具有以下服务器变量且名为ReportServer_MainInbound的规则:
<serverVariables>
<!--<set name="CMF_IS_REPORTSERVER" value="True" />-->
</serverVariables>
请删除该文件中的备注。该文件现在应该具有以下服务器变量定义:
<serverVariables>
<set name="CMF_IS_REPORTSERVER" value="True" />
</serverVariables>
保存并关闭文件。
UI\Web.config#
需要更改文件UI\Web.config的多个部分才能正确启用安全门户。请打开文件UI\Web.Config。在该文件中,您应该会看到以下appSetting:
<appSettings>
<!--<add key="CmfAuth_ClientId" value="..."/>-->
<!--<add key="CmfAuth_ClientSecret" value="..."/>-->
<!--<add key="CmfAuth_UserEndpoint" value="..."/>-->
<!--<add key="CmfAuth_ApiEndpoint" value="..."/>-->
<!--<add key="CmfAuthReports_ReportServerBaseUrl" value="..." />-->
<!--<add key="CmfAuthReports_HostEndpoint" value="..."/>-->
</appSettings>
这些appSetting的value取决于凯睿德MES安装期间传递的值。
请删除每个appSetting中的备注。该文件现在应该具有以下appSetting:
<appSettings>
<add key="CmfAuth_ClientId" value="..."/>
<add key="CmfAuth_ClientSecret" value="..."/>
<add key="CmfAuth_UserEndpoint" value="..."/>
<add key="CmfAuth_ApiEndpoint" value="..."/>
<add key="CmfAuthReports_ReportServerBaseUrl" value="..." />
<add key="CmfAuthReports_HostEndpoint" value="..."/>
</appSettings>
此外,还需要更新站点加载的IIS模块列表。在文件中,您应该看到模块CmfAuth和CmfAuthReports:
<modules>
<!-- <add name="CmfAuth" type="Cmf.Auth.IIS.Module.AuthenticationModule, Cmf.Auth.IIS.Module"/> -->
<!-- <add name="CmfAuthReports" type="Cmf.Auth.IIS.Module.ReportServer.ReportServerModule, Cmf.Auth.IIS.Module"/> -->
</modules>
请删除这些模块中的备注。该文件现在应该具有以下模块:
<modules>
<add name="CmfAuth" type="Cmf.Auth.IIS.Module.AuthenticationModule, Cmf.Auth.IIS.Module"/>
<add name="CmfAuthReports" type="Cmf.Auth.IIS.Module.ReportServer.ReportServerModule, Cmf.Auth.IIS.Module"/>
</modules>
此外,还需要更新URL重写规则。在该文件中,您应该看到一个名为Public Files的规则:
<rules>
<!--<rule name="Public Files" patternSyntax="ECMAScript" stopProcessing="true">
<match url="manifest.json|clientaccesspolicy.xml|crossdomain.xml" />
<serverVariables>
<set name="CMF_ALLOW_UNAUTHENTICATED" value="True" />
</serverVariables>
</rule>-->
</rules>
请删除URL重写规则Public Files中的备注。该文件现在应该具有以下规则:
<rules>
<rule name="Public Files" patternSyntax="ECMAScript" stopProcessing="true">
<match url="manifest.json|clientaccesspolicy.xml|crossdomain.xml" />
<serverVariables>
<set name="CMF_ALLOW_UNAUTHENTICATED" value="True" />
</serverVariables>
</rule>
</rules>
保存并关闭文件。
配置报表服务器设置#
为了对发送到报表服务器的请求进行身份验证,需要通过在凯睿德MES安装期间创建的特定IIS站点发送这些请求。该IIS站点的URL遵循以下模式$PROTOCOL/$IIS_SITE_URL:$PORT/$REPORT_INSTANCE/pages/ReportViewer.aspx,其中:
$PROTOCOL是http或https,取决于环境是否以HTTPS运行;$IIS_SITE_URL是安装了凯睿德MES的IIS实例的URL;$PORT是安装了凯睿德MES的IIS绑定端口;$REPORT_INSTANCE是包含凯睿德MES安装报表的SQL Server报表实例的名称。例如,如果用于访问SQL Server报表网页的URL为http://vm-db3/ReportServer_ONLINE,则$REPORT_INSTANCE为ReportServer_ONLINE。
例如,如果$PROTOCOL是http、$IIS_SITE_URL是vm-qa-env、$PORT是82以及$REPORT_INSTANCE是ReportServer_ONLINE,则用于对向报表服务器发出的请求进行身份验证的URL为http://vm-qa-env:82/ReportServer_ONLINE/pages/ReportViewer.aspx。
需要将该IIS站点的URL添加到GUI配置/Cmf/System/Configuration/Reporting/Report Server/中。要更改此配置,请打开GUI,然后在“管理”部分打开“配置”页面。使用“配置”页面设置配置/Cmf/System/Configuration/Reporting/Report Server/的值。
然后打开文件UI\Web.config,并确保appSetting CmfAuthReports_ReportServerBaseUrl指向SQL报表服务器的真实URL。例如,如果报表的原始URL为http://vm-db3/ReportServer_ONLINE/CriticalManufacturingSystem/_History/Report_ABC,则appSetting CmfAuthReports_ReportServerBaseUrl的值应该为http://vm-db3/ReportServer_ONLINE。同样,appSetting CmfAuthReports_HostEndpoint还应该包含用于连接到业务层级的IIS站点的URL。该URL的格式为$PROTOCOL/$IIS_SITE_URL:$PORT/api/,其中:
$PROTOCOL是http或https,具体取决于环境是否以HTTPS运行;$IIS_SITE_URL是安装了凯睿德MES的IIS实例的URL;$PORT是安装了凯睿德MES的IIS绑定端口。
例如,如果$PROTOCOL是http、$IIS_SITE_URL是vm-qa-env以及$PORT是82,则appSetting CmfAuthReports_HostEndpoint应该为http://vm-qa-env:82/api/。
另请参阅报表中的说明,了解安全门户访问报表需要哪些先决条件。