I have a report that seems to work fine, but when trying to download it in my asp.net MVC application, I get a 500. I am simply trying to download a pdf version of it using URL access. To do this I do the following:
WebClient client = new WebClient();
NetworkCredential nwc = new NetworkCredential(ConfigurationManager.AppSettings["SSRSUserName"], ConfigurationManager.AppSettings["SSRSPassword"]);
client.Credentials = nwc;
string paramList = "&OrderId=" + orderId;
string reportURL = ConfigurationManager.AppSettings["SSRSBaseUrl"] +
ConfigurationManager.AppSettings["SSRSReport"] +
"&rs:Command=Render&rs:Format=PDF" +
paramList;
try
{
byte[] reportBytes = client.DownloadData(reportURL);
}
To verify that my report works fine, I took the resulting reportURL string, threw it in a browser, and sure enough my report downloaded perfectly.
Does anybody know why I would get a 500 in my application, but the pdf would download perfectly fine outside of my application with the same URL? Is their some configuration that I am missing?
The server version is SQL Server 2016