How to grant permissions to a custom assembly that is referenced in a report in Reporting Services
2008-10-17 20:38
477 查看
Ref: http://support.microsoft.com/kb/842419/en-us
function loadTOCNode(){}
On This Page
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/downarrow.gif)
SUMMARY
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/downarrow.gif)
INTRODUCTION
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/downarrow.gif)
MORE INFORMATION
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/downarrow.gif)
Assert permissions in your custom assembly
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/downarrow.gif)
Make the custom assembly available to Report Designer and to Report Server
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/downarrow.gif)
Reference the custom assembly in your report
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/downarrow.gif)
Modify the code access security settings for your custom assembly
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/downarrow.gif)
REFERENCES
var sectionFilter = "type != 'notice' && type != 'securedata' && type != 'querywords'";
var tocArrow = "/library/images/support/kbgraphics/public/en-us/downarrow.gif";
var depthLimit = 10;
var depth3Limit = 10;
var depth4Limit = 5;
var depth5Limit = 3;
var tocEntryMinimum = 1;
This article describes a problem that occurs when you access a custom assembly in your report that does not have sufficient permissions on the resources in your environment. The article also provides steps to grant permissions to the custom assemblies that are used in the reports. To do this, follow these steps:
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif)
Back to the top
Reports that access custom assemblies may not render successfully if the custom assemblies do not have sufficient permissions. This article describes how to modify the policy configuration files to grant additional permissions to a custom assembly that is accessed by a report.
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif)
Back to the top
After you create a custom assembly by using the Microsoft .NET Framework, and then you access the custom assembly in your report and preview the report in Report Designer, the report may not render successfully. However, if you run the same report in DebugLocal mode in Report Designer or if you view the report by using Report Manager, the following error may be rendered in the report instead of the output of the referenced custom assembly:
#Error
Additionally, you may receive an error message that is similar to the following in Report Designer when you run the report in DebugLocal mode:
Request for the permission of type System.Security.Permissions.FileIOPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
This problem may occur when the custom assemblies that are referenced in your report do not have sufficient permissions.
Note If you preview the report in Report Designer, the report runs all the report expressions by using the FullTrust permission set. The report does not use the security policy settings.
To grant the required permissions to a custom assembly, follow these steps:
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif)
Back to the top
Note The examples provided in this section use C# code.
For example, if you access data in Microsoft SQL Server tables by using the "System.Data.SQLClient" namespace in your custom assembly, you must add the following code to your custom assembly before you use the "System.Data.SQLClient" namespace:
[/code]If you access a file in your custom assembly, you must add the following code to your custom assembly before you access the file:
[/code]Similarly, if you access a Web service in your custom assembly, you must add code that is similar to the following to assert the Web permissions:
[/code]For more information about asserting permissions in your custom assembly, visit the following MSDN Web site:
http://msdn2.microsoft.com/en-us/library/aa179495(SQL.80).aspx (http://msdn2.microsoft.com/en-us/library/aa179495(SQL.80).aspx)
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif)
Back to the top
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif)
Back to the top
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif)
Back to the top
After you access the custom assembly in your report and you run the report in DebugLocal mode, the report renders successfully.
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif)
Back to the top
For more information about code access security in Reporting Services, visit the following MSDN Web site:
http://msdn2.microsoft.com/en-us/library/aa902638(SQL.80).aspx (http://msdn2.microsoft.com/en-us/library/aa902638(SQL.80).aspx)
For more information about the using custom assemblies with reports in Reporting Services, visit the following MSDN Web site:
http://msdn2.microsoft.com/en-us/library/aa179513(SQL.80).aspx (http://msdn2.microsoft.com/en-us/library/aa179513(SQL.80).aspx)
For more information about debugging the custom assemblies in Reporting Services, visit the following MSDN Web site:
http://msdn2.microsoft.com/en-us/library/aa179526(SQL.80).aspx (http://msdn2.microsoft.com/en-us/library/aa179526(SQL.80).aspx)
How to grant permissions to a custom assembly that is referenced in a report in Reporting Services
View products that this article applies to.function loadTOCNode(){}
Article ID | : | 842419 |
Last Review | : | April 3, 2007 |
Revision | : | 2.1 |
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/downarrow.gif)
SUMMARY
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/downarrow.gif)
INTRODUCTION
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/downarrow.gif)
MORE INFORMATION
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/downarrow.gif)
Assert permissions in your custom assembly
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/downarrow.gif)
Make the custom assembly available to Report Designer and to Report Server
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/downarrow.gif)
Reference the custom assembly in your report
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/downarrow.gif)
Modify the code access security settings for your custom assembly
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/downarrow.gif)
REFERENCES
var sectionFilter = "type != 'notice' && type != 'securedata' && type != 'querywords'";
var tocArrow = "/library/images/support/kbgraphics/public/en-us/downarrow.gif";
var depthLimit = 10;
var depth3Limit = 10;
var depth4Limit = 5;
var depth5Limit = 3;
var tocEntryMinimum = 1;
SUMMARY
loadTOCNode(1, 'summary');This article describes a problem that occurs when you access a custom assembly in your report that does not have sufficient permissions on the resources in your environment. The article also provides steps to grant permissions to the custom assemblies that are used in the reports. To do this, follow these steps:
1. | Assert permissions in your custom assembly. |
2. | Make the custom assembly available to Report Designer and to Report Server. |
3. | Reference the custom assembly in your report. |
4. | Modify the code access security settings for your custom assembly. |
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif)
Back to the top
INTRODUCTION
loadTOCNode(1, 'summary');Reports that access custom assemblies may not render successfully if the custom assemblies do not have sufficient permissions. This article describes how to modify the policy configuration files to grant additional permissions to a custom assembly that is accessed by a report.
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif)
Back to the top
MORE INFORMATION
loadTOCNode(1, 'moreinformation');After you create a custom assembly by using the Microsoft .NET Framework, and then you access the custom assembly in your report and preview the report in Report Designer, the report may not render successfully. However, if you run the same report in DebugLocal mode in Report Designer or if you view the report by using Report Manager, the following error may be rendered in the report instead of the output of the referenced custom assembly:
#Error
Additionally, you may receive an error message that is similar to the following in Report Designer when you run the report in DebugLocal mode:
Request for the permission of type System.Security.Permissions.FileIOPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
This problem may occur when the custom assemblies that are referenced in your report do not have sufficient permissions.
Note If you preview the report in Report Designer, the report runs all the report expressions by using the FullTrust permission set. The report does not use the security policy settings.
To grant the required permissions to a custom assembly, follow these steps:
1. | Assert permissions in your custom assembly. |
2. | Make the custom assembly available to Report Designer and to Report Server. |
3. | Reference the custom assembly in your report. |
4. | Modify the code access security settings for your custom assembly. |
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif)
Back to the top
Assert permissions in your custom assembly
loadTOCNode(2, 'moreinformation');To acquire the required permissions to run the code in your custom assembly, you must assert the required permissions in your custom assembly code.Note The examples provided in this section use C# code.
For example, if you access data in Microsoft SQL Server tables by using the "System.Data.SQLClient" namespace in your custom assembly, you must add the following code to your custom assembly before you use the "System.Data.SQLClient" namespace:
[code]System.Data.SqlClient.SqlClientPermission pSql = new SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted); pSql.Assert();
[/code]If you access a file in your custom assembly, you must add the following code to your custom assembly before you access the file:
[code]FileIOPermission filePerm = new FileIOPermission(FileIOPermissionAccess.Read, "C:\TestFile"); filePerm.Assert();
[/code]Similarly, if you access a Web service in your custom assembly, you must add code that is similar to the following to assert the Web permissions:
[code]System.Text.RegularExpressions.Regex urlRegEx = new System.Text.RegularExpressions.Regex(@"http://www\.webcontinuum\.net/.*"); System.Net.WebPermission p = new System.Net.WebPermission(NetworkAccess.Connect,urlRegEx); p.Assert();
[/code]For more information about asserting permissions in your custom assembly, visit the following MSDN Web site:
http://msdn2.microsoft.com/en-us/library/aa179495(SQL.80).aspx (http://msdn2.microsoft.com/en-us/library/aa179495(SQL.80).aspx)
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif)
Back to the top
Make the custom assembly available to Report Designer and to Report Server
loadTOCNode(2, 'moreinformation');To make your custom assembly available to Report Designer and to Report Server, you must copy the custom assembly to the following folders:• | Installation Drive:\Program Files\Microsoft SQL Server\80\Tools\Report Designer |
• | Installation Drive:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\bin |
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif)
Back to the top
Reference the custom assembly in your report
loadTOCNode(2, 'moreinformation');To reference a custom assembly in your report, follow these steps:1. | Open the report project in Microsoft Visual Studio .NET 2003. |
2. | Open the report that must reference the custom assembly. |
3. | On the Report menu, click Report Properties. |
4. | In the Report Properties dialog box, click the References tab. |
5. | Under References, click the ellipsis button that is next to the Assembly name column header. |
6. | In the Add References dialog box, click Browse. |
7. | In the Select Component dialog box, locate and click your custom assembly, and then click Open. |
8. | In the Add References dialog box, click OK. |
9. | In the Report Properties dialog box, click OK. |
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif)
Back to the top
Modify the code access security settings for your custom assembly
loadTOCNode(2, 'moreinformation');To grant the required permissions to the custom assembly, you must modify the code access security settings in the policy configuration files that correspond to Report Designer and to Report Server. To do this, follow these steps:1. | Create the permission set element and the code group element for your custom assembly that specifies the required permissions. To do this, follow these steps:
| ||||||||||||||||||||||||||||||||||||||||||||
2. | Add the permission set and the code group that correspond to your custom assembly in the security policy configuration files for your report server. To do this, follow these steps:
|
![](http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif)
Back to the top
REFERENCES
loadTOCNode(1, 'references');For more information about code access security in Reporting Services, visit the following MSDN Web site:
http://msdn2.microsoft.com/en-us/library/aa902638(SQL.80).aspx (http://msdn2.microsoft.com/en-us/library/aa902638(SQL.80).aspx)
For more information about the using custom assemblies with reports in Reporting Services, visit the following MSDN Web site:
http://msdn2.microsoft.com/en-us/library/aa179513(SQL.80).aspx (http://msdn2.microsoft.com/en-us/library/aa179513(SQL.80).aspx)
For more information about debugging the custom assemblies in Reporting Services, visit the following MSDN Web site:
http://msdn2.microsoft.com/en-us/library/aa179526(SQL.80).aspx (http://msdn2.microsoft.com/en-us/library/aa179526(SQL.80).aspx)
相关文章推荐
- How to run a user control assembly that is hosted on Internet Information Services (IIS) in Internet Explorer
- 错误 the type "xxxx" is defined in an assembly that is not refernced.You must add a reference to assem
- 错误 the type "xxxx" is defined in an assembly that is not refernced.You must add a reference to assem
- How To Create a New User and Grant Permissions in MySQL
- How to create a hyperlink in SQL Server Reporting Services
- How to grant access to SQL logins on a standby database when the guest user is disabled in SQL Serve
- An attempt was made to set a report parameter that is not defined in this report
- How to sort by a form that is not displayed in the document in MicroStrategy Desktop 8.x
- How to Determine if a file is a .Net assembly (in Delphi and C#)
- How to render a 128 Barcode in Reporting Services or .Net applications
- HOW TO: Change the Owner of a User-Defined Data Type That Is in Use in SQL Server 2000
- How To Create a New User and Grant Permissions in MySQL
- The report server cannot decrypt the symmetric key that is used to access sensitive or encrypted data in a report server databas
- How To Create a New User and Grant Permissions in MySQL
- 32-bit Assembler is Easy, why and how to develop using the assembler; start learning to program in Assembly now!
- how to reference the parent form from the WPF control(Control in ElementHost)
- [XAF] How to use the Allow/Deny permissions policy in the existing project
- DLL程序组件Microsoft Reporting Services Barcode Custom Report Item
- How To Stop a Thread in .NET (and Why Thread.Abort is Evil)
- How to fix “The system is running in low-graphics mode” Ubuntu 17.04 or 16.04