OK, so you've spent the last (fill in some obscenely long time period) trying to get SQL Server Reporting Services to use your Custom Assembly for retrieving data from your application. But no matter what you try, you keep seeing #Error rather than your data when you run the report on the server.
By this point you've read countless white papers, tutorials, blog posts, etc... that outlining how the scenario should work*. That's right, you've added the necessary <codegroup> to your .config files. You've added references to your assembly from your report, and you've even made some example code (from the previously mentioned resources) work. You've tried everything you've read and everything you can think of.
I bet you've even tried banging your head on your desk/keyboard/wall hoping that magically it will just work. Well, it won't - so stop trying.
Here's a question for you - are you calling the System.Data assembly from your custom assembly?
You can tell by taking a peek at your project's References - if you see System.Data then you're probably using it. You're probably using the assembly to pull some data out of your database... that's what I typically use it for.
So, assuming you are using the System.Data assembly from your custom code, are you explicitly asserting the permissions you have to the database connection? What does that mean?
It means that the runtime will throw a security exception unless you've explicitly asserted the permissions that you want for the resource - a database connection in this case. Open your source code and find any places in your custom assembly that you're trying to access a new database connection.
Now right before you declare that new connection, add the following code:
SqlClientPermission permission =
new SqlClientPermission(PermissionState.Unrestricted);
permission.Assert();
Next make sure that you've allowed your assembly to be called from a RS report by adding the following assembly decorator to your AssemblyInfo class:
[assembly: AllowPartiallyTrustedCallers]
Ok, now recompile your assembly and drop the binaries to the necessary locations. Then hit your RS server and run the report. With any luck you'll see your custom data, and not that nasty #Error text.
If that didn't work for you, I'm not sure what to say other than... try reverting each of the RS .config files back to their original state (you did back them up, didn't you?) and then start start over. Reconfigure each file to make sure you don't skip anything.
* = If you're looking for a quick how-to, try this article.
Technorati tags:
ReportingServices