I have a CLR that runs an SSRS report. I created it three years ago and had to update it this week (hardcoded IP changed). It's the only one I've ever written, so I wrote notes in 2015 on how to update it. That initially appeared to work -- I rebuilt the dll from the C# project, saved the dll over the old dll in the server, and ran the following command:
alter assembly CLRtest4 from 'c:\HMCA_DLLs\CLRTest4.dll' with permission_set = SAFE;
Running it now gives the following errror: "The settings property 'CLRtest4_hdnysql1_ReportExecutionService' was not found".
In the C# I have:
// Report Server Settings
var reportExecutionService = new ReportExecutionService();
reportExecutionService.Credentials = System.Net.CredentialCache.DefaultCredentials;
System.Net.NetworkCredential nc = new System.Net.NetworkCredential("DDR", "<password>");
reportExecutionService.Credentials = nc;
reportExecutionService.Url = "http://hdnysql1/reportserver/reportexecution2005.asmx";
This code hasn't been touched. I checked that there's a dll.config file in the directory along with the DLL; there is, and it hasn't changed since three years ago. I've been searching the web and can't find anything about this error; I've no background in this other than figuring it once three years ago, and would really appreciate any help.
I spoke to a SQL consulting firm and got the answer; I'd post the company name here but am not sure whether that's against StackOverflow rules.
The config file had to be named sqlserver.exe.config, and it had to be in the binn folder, which I got via this query:
SELECT [filename] FROM sys.dm_server_services WHERE servicename LIKE N'SQL Server (%';
The file existed at that location but for some reason didn't have the relevant config lines in, even though the code had previously worked. Presumably the correct config was somehow cached before the file got moved. I copied the correct config file to that directory, and renamed it, and then
DBCC FREESYSTEMCACHE('ALL')
followed by
alter assembly CLRtest4 from 'c:\HMCA_DLLs\CLRTest4.dll' with permission_set = UNSAFE;
This fixed the issue.