SSRS streamIDs and chart images render with same id for different requests

狂风中的少年 提交于 2019-12-02 02:57:56

Posting a workable solution in case anyone is interested.

A. Calculate the physical and virtual mapping to a temp folder in your controller methods. a. NOTE : For reports with charts you should create a folder per request for the report. I used:

private string GetVirtualTempFolder()
{
    if (Url != null)
        return Url.Content("~/Temp/");
    else
        return VirtualPathUtility.ToAbsolute("~/Temp/");    
}

private string GetPhysicalTempFolder()
{
    return AppDomain.CurrentDomain.BaseDirectory + @"Temp\";
}

...

string virtualTempFolder = "";
string physicalTempFolder = "";
if (makeUniqueTempFolder)
{               

    virtualTempFolder = this.GetVirtualTempFolder();           
    physicalTempFolder = this.GetPhysicalTempFolder();
    string unique = Guid.NewGuid().ToString();
    virtualTempFolder = virtualTempFolder + unique + "/";
    physicalTempFolder = physicalTempFolder + unique + "/";
    System.IO.Directory.CreateDirectory(physicalTempFolder);
}

B. Pass the directory names into your reporting services wrapper layer. I am using a DI so the signatures needed to be modified.

C. In the ReportingServices Rendering api you can pass the chosen virtual directory to pull temp files associated with streams via the DeviceInfo interface.

D. The streamIDs are returned in the Render method. Iterate and save them to the calculated physical location.

While I already had the temp folder functionality working, I had to add the ability to optionally create a temp location per request.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!