.net - C# method not working when called via published WebAPI -


I have simplified my method for testing purposes, it works fine when running locally in VS 2013 debug mode .

Here's my APIC Controller:

  Namespace Citizens. Hub WebAPI Controllers {Public Sector Reports Controller: API Controller {HttpGet} Public Zero RunAttendanceByYear (String School, String Offdate, String Todate) {var runreport = new AttendanceReports (); Runreport.WebAPITest (school, current, todate); }}}  

Here's my simple method to test:

  Public Zero WebAPITest (string, school, string, password, string toadet) {// Create a new Excel, workbook, and worksheet instance of Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application (); Workbook xlWorkbook = xlApp.Workbooks.Add (); Sheet xlSheets = xlWorkbook.Sheets as Sheets; // Create a new worksheet for the school worksheet xlNewSheet = (worksheet) xlSheets.Add (xlSheets [1], type missing, type missing, type missing); // worksheet header xlNewSheet.Cells [1, "A"] = "school"; XlNewSheet.Cells [1, "B"] = "to"; XlNewSheet.Cells [1, "c"] = "to"; // Populated Sheet with Data xlNewSheet.Cells [2, "A"] = School; XlNewSheet.Cells [2, "b"] = addicted; XlNewSheet.Cells [2, "c"] = todate; // Defined file name and file path string filename = string.format (@ "{0} \ Test.xlsx", environment GETFolderPath (Environment.SpecialFolder.DesktopDirectory); // Save this data as a file xlWorkbook.SaveAs (fileName); // Exit Excel app xlApp.Quit (); // Release COM objects if (xlap! = Empty) system. Time.Intoop Services Mrishal Release com object (extl); If (XL Workbook! = Faucet) System. Runtime. Interop Services Martial Release Com Object (XL Workbook); Xlap = null; XlWorkbook = Null; GC.Collect (); }  

Debug mode and output on the desktop works fine when running in "Test.xlsx".

When I publish WebAPi locally and it specifies port number 1111, it just does not want to work. I believe IIS is configured correctly because when I browse it If I do, I get the default VS WebAPI home page.

My call is: http: // localhost: 1111 / api / reports? School = test school & amp; ; Fromdate = 2013-09-01 & todate = 2014-02-07

I get a 'canceled' result in IE and the response is not HTTP / 1.1 204 content

Any advice? Thank you.

Root Config:

  Public square root config {public static zero registrations (routes collection path) {routes.gnoreRoute ("{resource} .axd / {* pathInfo} "); Routes.MapRoute (name: "default", url: "{controller} / {action} / {id}", default: new {controller = "home", action = "index", id = urlparameter.option}}; }}  

The problem was with IIS and permissions. I originally used this link here I follow the steps of:


Comments