Challenge

  • Today I have to troubleshoot application hosted at Azure Web App
  • I am receiving error “Internal server error” for the functionality which we are testing
  • For Azure Web App we have less control as we don’t get Remote desktop for the same
  • So we will see how to troubleshoot Azure Web App with Kudu

Solution

  • In manage azure portal please open your Azure Web App >> Then go to Configure Section as follow

  • We need to set application diagnostics and site diagnostics settings as follows
  • Please make sure you set Detailed error message as follows

  • After that save the settings
  • Now we have to analyse the logs for that purpose we need to use Kudu which is analysis and troubleshooting tools for Azure Web Apps
  • Kudu is useful to capture and review memory dumps, deployment logs and detailed error message
  • To use Kudu we need to browse following Web App
  • To access your KUDU console, using your DEPLOYMENT credentials, then browse to https://YOURWebApp.scm.azurewebsites.net we will see following Web App

Kudu

  • In above you can review lot of logs for your application however to diagnose the issues we need to go to Tools >> Diagnostic dump
  • This will provide you the zip file
  • From the zip file browse the LogFiles >> DetailedErrors to review and troubleshoot errors
  • If you don’t have manage azure credentials then you can also review log from your FTP folder in logs folder

Hope this helps

Challenge

  • Recently we have implemented functionality to export PDF from ASP.Net Web Application
  • We don’t want to render report in Report Viewer we only want to export PDF
  • When we deployed the application on Azure VM ( IaaS ) then everything was working fine
  • However when we have published the application on Azure Web App ( PaaS ) we are getting exceptions and issues
  • Please refer following code for reference ( which we have used to export PDF )

//list testReportModel
List<TestReportModel> testReportModel = GetReportData();

//get report bytes
Byte[] reportBytes = Common.GetReportByte(“~/Report/TestReport.rdlc”, testReportModel, “dsTestReport”, “PDF”);

//instantiate memory steram
MemoryStream reportStream = new MemoryStream(reportBytes);
reportStream.Seek(0, SeekOrigin.Begin);

Response.Buffer = true;
Response.ContentType = “application/pdf”;
Response.AddHeader(“content-disposition”, “attachment; filename=TestReport.pdf”);
Response.BinaryWrite(reportBytes);
Response.Flush(); // send it to the client to download
Response.Clear();

Solution

  • Please verify that following report viewer dll assemblies has copy local true in your solution explorer as follows

  • In your deployment package in bin folder please make sure you have following dll assemblies

  • If you want to use ReportViewer control then there is no support to render in Azure Web App then you have to either use Azure Web Role or Azure VM

Hope this helps