The problem is that one of my colleagues reported that they encountered a technical problem in the following scenario: When ReportingServices calls a local assembly, it can be displayed normally during preview, however, when deployed on the server or debugging in the development window, an "error code" is displayed, with no specific error content. At the beginning, this really makes us very uncomfortable.
Solution 1:
Search for these keywords through Google. A Daniel on the Internet explained that the ReportingServices service and the iis service need to be stopped, and then the dll needs to be copied to the corresponding folder, then start these services. After many attempts by my colleagues and I both ended in failure. Solution 1 fails to be declared. At that time, the Daniel was very far-fetched and unconvincing.
Solution 2:
Through comparison and reasonable reasoning, we can find out something suspicious: The Preview window can be displayed normally, but it cannot be displayed on the server or the development window. This indicates that it was executed normally once, this easily reminds me of permission issues.
The report designer has two preview modes: preview tab andDebugLocalThe pop-up preview window started when the report project is started."Preview"The tab is not a security object component and does not apply security policy settings.
So I thought of modifying the access permission of the Assembly.
The following table lists the policy configuration files, file locations (assuming the default installation), and their respective functions in Reporting Services.
| File Name |
Location (default installation) |
Description |
Rssrvpolicy. config |
C: \ Program Files \ Microsoft SQL Server \ MSSQL \ Reporting Services \ ReportServer |
The policy configuration file of the Report Server. After deploying a Report to the Report Server, these security policies mainly affect the report expressions and custom assembly. This policy file also affects custom data, transfer, rendering, and security extensions deployed on the Report Server. |
Rsmgrpolicy. config |
C: \ Program Files \ Microsoft SQL Server \ MSSQL \ Reporting Services \ ReportManager |
The policy configuration file of the report manager. These security policies affect all the assembly of the extended report manager, such as the subscription User Interface extension plug-in for custom transfer. |
Rspreviewpolicy. config |
C: \ Program Files \ Microsoft SQL Server \ 80 \ Tools \ ReportDesigner |
The report designer independently previews the policy configuration file. These security policies affect the custom datasets and report expressions used in reports during preview and development. These policies also affect custom extensions deployed to the report designer, such as the event processing extension. |
In addition, there is a Web. config file.
The Assembly configurations of these config files are similar. The specific operations are as follows:
1. find the text Name = "Report_Expressions_Default_Permissions" in the file and change the content of the previous line to PermissionSetName = "FullTrust". If it is a production environment, we do not recommend this operation, we only recommend that you make such changes in the development environment. (The default Execution permission of ReportingServices for expressions is "Execution", which must be changed to "FullTrust ")
2. In the corresponding Config file (except web. config), add a reference to the custom Assembly before the last 2nd </CodeGroup>:
Added Assembly permission settings
<CodeGroup class = "UnionCodeGroup" version = "1" PermissionSetName = "FullTrust" Description = "ClassLibrary1.dll">
<IMembershipCondition class = "StrongNameMembershipCondition" version = "1" Url = "D: \ Program Files \ Microsoft SQL Server \ MSSQL.3 \ Reporting Services \ ReportServer \ bin \ ClassLibrary1.dll"/>
</CodeGroup>
Because my dll uses a strong name, class = "strongnamememembershipcondition". Select the appropriate method based on the dll method. For details, refer to MSDN.
3. In Web. config, modify <System. web> <trust> in the node is <trust level = "Full" originUrl = ""/>
If you do not understand the Assembly settings, you can use either of the following methods:
1. Find MSDN and learn more about Assembly settings.
2. add an assembly to GAC, set the corresponding permissions, and then go to C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727 \ CONFIG \ security. search for the Assembly permission settings you just added in config, and modify them as you go. This is a simple and quick solution to the problem.
To avoid copying the assembly to the corresponding folder every time, I wrote a batch to save time for manual searching.
Copy the batch code of the Assembly
Copy "E: \ Sources \ Lib \ bin \ Debug \ Lib. dll "" D: \ Program Files \ Microsoft SQL Server \ MSSQL.3 \ Reporting Services \ ReportServer \ bin \ Lib. dll"
Copy "E: \ Sources \ Lib \ bin \ Debug \ Lib. dll "" C: \ Program Files \ Microsoft Visual Studio 8 \ Common7 \ IDE \ PrivateAssemblies \ Lib. dll"
Echo. & pause