1

尝试通过 WebRequest 对象执行 SSRS 报告。获取响应的调用给出了“500 Internal Server Error”,没有更多信息(我检查参数值等在浏览器中是否有效)

我调试抓取网址,并将其粘贴到浏览器中,它成功运行。

http://devBI/ReportServer?%2fSSRS+Project%2fValuationReport&rs:Command=Render&rs:Format=EXCEL&ReportDate=23/06/2013&ClientCode=QWECT&IsEOM=0

有问题的代码是:

WebRequest Request = HttpWebRequest.Create(reportUrl);
Request.Credentials = CredentialCache.DefaultCredentials;
log.Debug("Credentials for request: " + Request.Credentials.ToString());
if (config.UseInfiniteTimeout)
{
    Request.Timeout = System.Threading.Timeout.Infinite;
}
else
{
    Request.Timeout = config.TimeoutSeconds * 1000;
}

Request.Method = "GET";
try
{
    HttpWebResponse Response = (HttpWebResponse)Request.GetResponse();
    using (Stream ResponseStream = Response.GetResponseStream())
    {
        string responseString;
        StreamHelper.CopyStream(Response.GetResponseStream(), out responseString);
        ResponseStream.Flush();
        ResponseStream.Close();

        log.Debug("Response string: " + responseString);
        return responseString;
    }
}
catch (Exception e)
{
    log.Error("Error encountered during WebRequest/Response: " + e.ToString());
    throw;
}
4

1 回答 1

0

回答并非所有的客户都是一样的!(日期格式是问题)。

在浏览器 (Internet Explorer) 中测试时允许的日期格式是dd/MM/yyyy

从 Visual Studio 调用时允许的日期格式是MM/dd/yyyy

注意:我不知道在哪里可以更改此行为,并且找不到此 SSRS“功能”的任何文档

于 2013-06-25T07:14:26.227 回答