Reporting services 允许在SSRS报告中使用Javascript表达式
我的问题是:我试图在报告中以特定的表达式运行javascript 这是我文本框中的内容:Reporting services 允许在SSRS报告中使用Javascript表达式,reporting-services,ssrs-2012,Reporting Services,Ssrs 2012,我的问题是:我试图在报告中以特定的表达式运行javascript 这是我文本框中的内容: =Code.test() 在我的报告属性中,我得到了以下代码: Function test() AS String System.Web.HttpContext.Current.Response.Write("< script language='javascript' >alert('This is a test');< /script >") retur
=Code.test()
在我的报告属性中,我得到了以下代码:
Function test() AS String
System.Web.HttpContext.Current.Response.Write("< script language='javascript' >alert('This is a test');< /script >")
return ""
End Function
我在以下链接上看到,我必须完全信任大会:
现在,我假设(可能是错误的)必须为其提供fulltrust值的程序集是:AspNetHostingPermission
所以我将其添加到rssrvpolicy.config和rsmgrpolic.config中
<CodeGroup
class="FirstMatchCodeGroup"
version="1"
PermissionSetName="FullTrust"
Description="This code group grants MyComputer code Execution permission. ">
<IMembershipCondition
class="AspNetHostingPermission"
version="1"
Zone="MyComputer" />
</CodeGroup>
但是,重新启动报表服务器并尝试访问localhost/reportserver时,出现以下错误:
图书馆!默认域名!3b38!2017年2月14日-11:20:34::e错误:抛出
Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerHttpRuntimeInternalException:
无法创建HTTP运行时,
Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerHttpRuntimeInternalException:
的HTTP运行时对象中发生内部或系统错误
应用程序域ReportServer\u MSSQLSERVER\u 0。-->
System.Web.HttpException:无法加载文件或程序集
'ReportingServicesWebServer,版本=12.0.0.0,区域性=中性,
PublicKeyToken=89845dcd8080cc91'或其依赖项之一。这个
参数不正确。(HRESULT的例外情况:0x80070057
(E_INVALIDARG))(C:\Program Files\Microsoft SQL
Server\MSRS12.MSSQLSERVER\Reporting Services\ReportServer\web.config
第14行)--->System.Configuration.configurationErrors异常:可能
未加载文件或程序集的ReportingServicesWebServer,
版本=12.0.0.0,区域性=中性,PublicKeyToken=89845dcd8080cc91'或
它的一个依赖项。参数不正确。(不适用于
HRESULT:0x80070057(E_INVALIDARG))(C:\Program Files\Microsoft SQL
Server\MSRS12.MSSQLSERVER\Reporting Services\ReportServer\web.config
第14行)--->System.IO.FileLoadException:无法加载文件或
程序集的ReportingServicesWebServer,版本=12.0.0.0,
区域性=中性,PublicKeyToken=89845dcd8080cc91'或其
依赖关系。参数不正确。(HRESULT的例外情况:
0x80070057(E_INVALIDARG))文件名:“ReportingServicesWebServer,
版本=12.0.0.0,区域性=中性,PublicKeyToken=89845dcd8080cc91'
--->System.ArgumentException:元素必须是元素。-->System.ArgumentException:
类型未实现IMembershipCondition
我想这是因为我想在哪里添加代码组?我不太熟悉这两个配置文件的文件结构。如果有更博学的人能给我指出正确的方向,那就太棒了
作为旁注:我将另一个代码组更改为Permission FullTrust,只是为了看看它是否会更改某些内容(上面没有我额外的xml代码),但它没有更多地启用javascript代码,它仍然给我#error你在报告中使用javascript想要实现什么?现在这只是一个基本测试,只是试图使弹出窗口显示警报。然而,在未来,我希望能够获取一个文件I/O来读取一个文件,然后从那里获取JS(我们有多个报告,~250,我希望所有报告都有一个JS文件,以解决模块化问题,如果我需要更改某些内容的话)你还没有说除了加载更多的javascript之外,你还想用javascript实现什么…哦,基本上在我的html页面中显示一张图片/在报告中创建一个新的div?我建议您要么从报表中的内置功能加载图片,要么在格式化的iframe中显示报表。研究如何在网页中无缝显示报告,您可以在页面的其余部分拥有完整的HTML/CSS/JS控件。
<CodeGroup
class="FirstMatchCodeGroup"
version="1"
PermissionSetName="FullTrust"
Description="This code group grants MyComputer code Execution permission. ">
<IMembershipCondition
class="AspNetHostingPermission"
version="1"
Zone="MyComputer" />
</CodeGroup>