November Happy Hour will be moved to Thursday December 5th.

Episerver page working on local but not on Production

Vote:
 

I have a page controller having two actions. One is index and one is download like below

        public async Task Index(ReportPage currentPage, string id)
        {
            /* Implementation of action. You can create your own view model class that you pass to the view or
             * you can pass the page type for simpler templates */

            // todo: check if the report id is valid

            Report report = null;
            ReportPageViewModel model = null;

            if (String.IsNullOrEmpty(id))
            {
                model = new ReportPageViewModel(currentPage, report);
                return View(model);
            }

            report = await RystadGlobal.api.GetReport(Authentication.GetTokenTypeFromCookie(), Authentication.GetTokenFromCookie(), int.Parse(id));

            model = new ReportPageViewModel(currentPage, report);
            return View(model);
        }
        public async Task Download(ReportPage currentPage, string id)
        {
            try
            {
                Report report = await RystadGlobal.api.GetReport(Authentication.GetTokenTypeFromCookie(), Authentication.GetTokenFromCookie(), int.Parse(id));

                string ext = Path.GetExtension(report.fileName);

                byte[] byteArray = await RystadGlobal.api.DownloadReport(RystadIdentity.Current.AuthenticatedUser.TokenType, RystadIdentity.Current.AuthenticatedUser.Token, report.Id);


                var name = RystadIdentity.Current.AuthenticatedUser.UserInfo.name;


                if (ext.ToLower() == ".pdf")
                    byteArray = PdfWatermarker.Watermark(byteArray, name);

                return File(byteArray, System.Net.Mime.MediaTypeNames.Application.Octet, report.fileName);

            }
            catch (Exception e)
            {
                throw new Exception("Something went wrong when downloading file.");
            }

        }

The issue is the Download action is working on localhost like

http://localhost:12345/ReportPage/Download/ID

but the same thing is not working on production

http://mywebsite/ReportPage/Download/ID

When I hit thsat page I get

Page could not be loaded

The link you specified does not work. This may either be the result of temporary maintenance or an incorrect link.

Any pointers?

#186756
Jan 04, 2018 7:33
Vote:
 

Try removing the try catch statement and then check your log file.

#186760
Jan 04, 2018 9:42
Vote:
 

Looks like there is some error, please make sure that you can see runtime errors. So, change settings in web.config file to see errors and remove try catch block as mentioned by Oskar.

#186761
Jan 04, 2018 9:46
Vote:
 

If you're on the DXC rather than changing the log files you should get Episerver to turn on Error logging and then use the PASS portal to see the web server errors streamed from the production server. This would be better than changing the web.config and even if you change the web.config sometimes the Azure config will stop you seeing application errors on the DXC in my expereince.

#186762
Jan 04, 2018 10:21
Vote:
 

You can also have a look into New relic application. It shows application and environment errors which sometimes are not captured in application logs in detailed.

#193880
Jun 07, 2018 8:20
Vote:
 

Yes although it's worth nothing this is moving to application insights now for any new clients but the same principle applies

#194988
Jul 10, 2018 17:36
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.