405 Method Not Allowed - IIS

Hello,

Spreadsheet works fine locally but when pushed to IIS throws 405 not allowed for POST for the openurl property of spreadsheet, can we make it a GET request etc to make it work, please advise.

<ejs-spreadsheet openurl

7 Replies 1 reply marked as answer

SP Sangeetha Priya Murugan Syncfusion Team May 10, 2021 11:03 AM UTC

Hi Umair, 
 
Thank you for contacting Syncfusion support. 
 
We have checked your reported issue and before we proceed further, please share the below details. 
 
1. Please confirm whether you are using local service or our EJ2 web service link for Open/Save functionality. 
2. If you are using local service for Open/Save functionality please share customization codes for this. 
3. Share the control rendering codes for spreadsheet control. 
4. If you are import any excel file at initial load, please share us the Excel file. 
5. Please confirm whether you are hosting Angular UI application or Web service application in IIS in your end? 
6. If possible, please share the video demonstration of this issue. 
 
Could you please get back to us with the above requested information? Based on that we will check and provide you a better solution quickly. 
 
Regards, 
Sangeetha M 



UA Umair Ahmed May 10, 2021 12:05 PM UTC


1.Please confirm whether you are using local service or our EJ2 web service link for Open/Save functionality. 
     Local Service
2. If you are using local service for Open/Save functionality please share customization codes for this. 
public IActionResult Open(IFormCollection openRequest, int Id)
        {
            ExcelEngine excelEngine = new ExcelEngine();
            IWorkbook workbook;
            Stream memStream = (openRequest.Files[0] as IFormFile).OpenReadStream();
            workbook = excelEngine.Excel.Workbooks.Open(memStream, ExcelOpenType.SpreadsheetML2007);
            List<CustomArgs> customArgs = GetCustomArgs(workbook,Id);
            MemoryStream outputStream = new MemoryStream();
            workbook.SaveAs(outputStream);
            //outputStream.Position = 0;
            IFormFile formFile = new FormFile(outputStream, 0, outputStream.Length, "", openRequest.Files[0].FileName); 
            //outputStream.Close();
            OpenRequest open = new OpenRequest();
            open.File = formFile;
            var content = Workbook.Open(open);
            content = content.Insert(content.Length - 2, ", \"customArgs\":" + JsonConvert.SerializeObject(customArgs));
            return Content(content);
        }
3. Share the control rendering codes for spreadsheet control. 
ejs-spreadsheet #default (created)="onCreated($event)" (ngAfterContentChecked)="LoadSpread($event)" (beforeCellRender)="OnBefore($event)" (select)="onCellClick($event)"  [openUrl]="openLoc" (openComplete)="onOpenComplete($event)" mode="None" (loadComplete)="LoadSpread($event)"  [allowOpen]="true"> </ejs-spreadsheet>
4. If you are import any excel file at initial load, please share us the Excel file. 
5. Please confirm whether you are hosting Angular UI application or Web service application in IIS in your end? 
    Yes we use web service application in IIS 



BB Brian Braatz May 10, 2021 05:44 PM UTC

we are running under IIS we get the eror

when we run visual studio no error

we are using asp.net coree on server




BB Brian Braatz May 10, 2021 05:45 PM UTC

NO OPEN or save

we have xls on the server- we need to display on web page

when we call openurl to our server- it works on visual studio running server

on iis we get 405 error

WE ARE SUPPOSED TO GO LIVE TOMORROW AND whole team is stressed about this :( 


BB Brian Braatz May 10, 2021 05:47 PM UTC

we put a log entry and our code for 
below NEVER gets call when running on iIS

 If you are using local service for Open/Save functionality please share customization codes for this. 
public IActionResult Open(IFormCollection openRequest, int Id)
        {
            ExcelEngine excelEngine = new ExcelEngine();
            IWorkbook workbook;
            Stream memStream = (openRequest.Files[0] as IFormFile).OpenReadStream();
            workbook = excelEngine.Excel.Workbooks.Open(memStream, ExcelOpenType.SpreadsheetML2007);
            List<CustomArgs> customArgs = GetCustomArgs(workbook,Id);
            MemoryStream outputStream = new MemoryStream();
            workbook.SaveAs(outputStream);
            //outputStream.Position = 0;
            IFormFile formFile = new FormFile(outputStream, 0, outputStream.Length, "", openRequest.Files[0].FileName); 
            //outputStream.Close();
            OpenRequest open = new OpenRequest();
            open.File = formFile;
            var content = Workbook.Open(open);
            content = content.Insert(content.Length - 2, ", \"customArgs\":" + JsonConvert.SerializeObject(customArgs));
            return Content(content);
        }
--------------

when we put DLL on IIS we get a 405 error
it works fine when the server is visuakl studio 



PN Preethi Nesakkan Gnanadurai Syncfusion Team May 11, 2021 06:18 AM UTC

From: Ahmed, UmairXSent: Monday, May 10, 2021 12:18 PM
To: Syncfusion Support <[email protected]>
Subject: FW: Syncfusion support community forum 165311, 405 Method Not Allowed - IIS, has been updated. 


This is urgent, if someone can respond right away that would be great. Thanks. 




SP Sangeetha Priya Murugan Syncfusion Team May 11, 2021 03:27 PM UTC

Hi Umair,  
 
Thank you for your update. 
 
We have checked your reported issue and it depends upon the IIS configuration with ASP.NET Core hosted application in your machine . And we suggest you refer the below links for that describes, the options need to be enabled while hosting application in IIS server.  
 
 
Steps to deploy ASP.Net core application in IIS 
 
 
 
Could you please check the above links and ensure the dependent items are installed in your machine? And kindly get back to us, if you need any further assistance on this. 
 
Regards, 
Sangeetha M 


Marked as answer
Loader.
Up arrow icon