Cant load file

hello iam trying to copy the example to my project this is my code

public class BarCodeController : Controller
{
private readonly IWebHostEnvironment _hostingEnvironment;
private readonly IMemoryCache _cache;
private readonly IHttpContextAccessor _accessor;

  public IActionResult Index()
  {
      var report = new XtraReport1();
      report.xrLabel1.Text = "momen";
      return View( report);
  }


  public BarCodeController(IWebHostEnvironment hostingEnvironment, IMemoryCache cache, IHttpContextAccessor httpContextAccessor)
  {
      _hostingEnvironment = hostingEnvironment;
      _cache = cache;
      _accessor = httpContextAccessor;




  }

  [HttpPost]
  public IActionResult OpenDocument(string fileName)
  {
      var pathToFile = Path.Combine(Path.Combine(_hostingEnvironment.WebRootPath, "files"), fileName);

      if (!System.IO.File.Exists(pathToFile))
      {
          Response.StatusCode = 404;
          return Content($"File does not exists: {pathToFile}");
      }

      var fileInfo = new FileInfo(pathToFile);

      var licenseFilePath = Path.Combine(_hostingEnvironment.WebRootPath, "Doconut.lic");

      var docViewer = new Viewer(_cache, _accessor, licenseFilePath);

      var documentOptions = new DocOptions
      {
          Password = "",
          ImageResolution = 200,
          Watermark = "^Sample Copy~Red~24~Verdana~50~-45",
          TimeOut = 30
      };

      BaseConfig? config = null;

      switch (fileInfo.Extension.ToUpper())
      {
          case ".DOC":
          case ".DOCX":
          case ".DOT":
          case ".DOTX":
          case ".ODT":
              config = new WordConfig { DefaultRender = true, PdfConfig = new PdfConfig { DefaultRender = true, ExtractHyperlinks = true, HyperlinksPageCount = 5, AllowCopy = true } };
              break;
          case ".XLS":
          case ".XLSX":
          case ".ODS":
          case ".CSV":
              config = new ExcelConfig
              {
                  SplitWorksheets = true,
                  ShowEmptyWorkSheets = false,
                  DocumentCulture = "en-US",
                  PaperSize = ExcelPaperSize.PaperA3,
                  AutoFitContents = true,
                  DefaultRender = true,
                  ExportOnePagePerSheet = true,
                  RemoveEmptyContent = false,
                  CustomStyles = new ExcelConfig.CustomStyleCell
                  {
                      CustomStyleDateTime = "dd-MM-yyyy"
                  },
              };
              break;
          case ".PPT":
          case ".PPTX":
          case ".ODP":
              config = new PptConfig()
              {
                  DefaultRender = true,
              };
              break;
          case ".DWG":
          case ".DXF":
              config = new CadConfig { DefaultRender = false, ShowColor = false, WhiteBackground = true, ShowModel = true, ShowLayouts = true, LineWidth = 1, Check3DSolid = false, LimitMaximumSize = true };
              break;
          case ".DGN":
              config = new CadConfig { DefaultRender = true, ShowColor = false, WhiteBackground = true, ShowModel = true, ShowLayouts = true, LineWidth = 1, Check3DSolid = false };
              break;
          case ".EML":
          case ".MSG":
              config = new EmailConfig { EmailEncoding = Encoding.UTF8, DefaultRender = true, RemoveLastWhitePage = true, TimeZoneOffset = new TimeSpan(-3, 0, 0) };
              break;
          case ".PDF":
              config = new PdfConfig { DefaultRender = true, ExtractHyperlinks = true, HyperlinksPageCount = 5, AllowCopy = true };
              break;
          case ".PNG":
          case ".BMP":
          case ".JPG":
          case ".JPEG":
          case ".GIF":
          //
          case ".CDR":
          case ".CMX":
          case ".DNG":
          case ".EPS":
          case ".ICO":
          case ".TGA":
          case ".WEBP":
              config = new ImageConfig { MaxImagePixelSize = 2000, TransparentPng = false };
              break;
          case ".TIF":
          case ".TIFF":
              config = new TiffConfig();
              break;
          case ".PSD":
              config = new PsdConfig { MaxImagePixelSize = 2000 };
              break;
          case ".TXT":
              config = new TxtConfig { PaperSize = DocPaperSize.A4 };
              break;
          case ".MPP":
          case ".MPPX":
              config = new ProjectConfig { ExportPdfA = true, DefaultRender = true, PaperSize = MppPaperSize.A3 };
              break;
          case ".VSD":
          case ".VSDX":
              config = new VisioConfig { ExportPdfA = true, DefaultRender = false };
              break;
          case ".DCM":
              config = new DicomConfig { ShowAnimation = true };
              break;
          case ".HTML":
          case ".HTM":
              config = new HtmlConfig();
              break;
          case ".MHT":
              config = new MhtConfig { DefaultRender = false };
              break;
          case ".XPS":
              config = new XpsConfig { DefaultRender = false };
              break;
      }


      try
      {
          var token = docViewer.OpenDocument(pathToFile, config, documentOptions);

          return Content(token);
      }
      catch (Exception e)
      {
          Response.StatusCode = 500;
          return Content(e.Message);
      }

  }

}

/////////////////////

@using Filecom.Core.Services
@{
ViewBag.Title = “Doconut Viewer”;
}

.NET Core 6.0 (Modal) 
Close

when I press on any doc or xls file its how me like the page
thanks
image.png (52.9 KB)

@hamzzadwe.mtech,

Thank you for sharing your code and details. From what you’ve posted, it looks like you’ve correctly set up the controller and configuration logic, but the runtime error you mentioned usually indicates that some required client-side scripts or resources are not being loaded. With only the controller code, it’s difficult for us to pinpoint the exact cause.

To help us reproduce and troubleshoot the issue accurately, could you please compress your project into a basic ZIP example (with minimal code to replicate the problem) and attach it here?

Once we have your full example, we’ll be able to provide more precise guidance. Please feel free to share any additional details or questions you may have