ASP.NET Core WebAPI 500 Internal Error in IIS 7.5


Brandon

I am trying to get this WebAPI to work. Well, use IIS. Everything works fine in IIS express, but when I publish it, especially 1 api request doesn't work. The url I am trying to access API/[Controller]/{date}/{integer}. I keep getting a 500 server error. Another API/[Controller]/{date}working line of mine .

Here is my API controller:

[Route("api/[controller]")]
    public class PostingsController : Controller
    {
        // GET: api/Postings/5
        [HttpGet("{date}")]
        public string Get(string date)
        {
            return date;
        }

        // GET api/Postings/20160407/2
        [HttpGet("{date}/{modeID}")]
        public List<TruckPosting> Get(string date, int modeID)
        {
            TruckPosting tp = new TruckPosting();
            List<TruckPosting> truckPostings = tp.GetTruckPostings(date, modeID);
            return truckPostings;
        }
    }

Could the reason be that I'm returning a List<>? I'm baffled considering it works fine in IIS Express in VS.

edit

Here is my startup.cs page:

public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();
        }

public void Configure1(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
            {
                app.UseIISPlatformHandler();
                app.UseDefaultFiles();
                app.UseStaticFiles();
                app.UseFileServer(true);
                app.UseMvc();
            }

            // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
            {
                app.Map("/appRoot", (app1) => this.Configure1(app1, env, loggerFactory));
            }
Clint B

A good idea is that you might be returning a list. We have valid Core Web API methods and all methods return Task<IEnumerable<Foo>>. Try changing the return type List<TruckPosting>toTask<IEnumerable<TruckPosting>>

Edit: To see the details of a 500 (Internal Server) error, you need to put the following line of code at the beginning of the Configure (or Configure1) method:

app.UseDeveloperExceptionPage();   

Obviously, this is not something you want in a production environment.

EDIT2: When running in VS, as long as the Hosting:Environment variable in the Debug section of Properties is set to Development, the following code can be used to display exception details. After publishing, you will need to create a system environment variable called ASPNET_ENV and set its value to "Development", otherwise the code will not call the UseDeveloperExceptionPage() method.

if (env.IsDevelopment())
{
    app.UseDeveloperExceptionPage();
}

Related


ASP.NET Core WebAPI 500 Internal Error in IIS 7.5

james I am trying to get this WebAPI to work. Well, use IIS. Everything works fine in IIS express, but when I publish it, especially 1 api request doesn't work. The url I am trying to access API/[Controller]/{date}/{integer}. I keep getting a 500 server error.

ASP.NET Core WebAPI 500 Internal Error in IIS 7.5

james I am trying to get this WebAPI to work. Well, use IIS. Everything works fine in IIS express, but when I publish it, especially 1 api request doesn't work. The url I am trying to access API/[Controller]/{date}/{integer}. I keep getting a 500 server error.

ASP.NET Core WebAPI 500 Internal Error in IIS 7.5

james I am trying to get this WebAPI to work. Well, use IIS. Everything works fine in IIS express, but when I publish it, especially 1 api request doesn't work. The url I am trying to access API/[Controller]/{date}/{integer}. I keep getting a 500 server error.

ASP.NET Core WebAPI 500 Internal Error in IIS 7.5

james I am trying to get this WebAPI to work. Well, use IIS. Everything works fine in IIS express, but when I publish it, especially 1 api request doesn't work. The url I am trying to access API/[Controller]/{date}/{integer}. I keep getting a 500 server error.

ASP.NET Core WebAPI 500 Internal Error in IIS 7.5

james I am trying to get this WebAPI to work. Well, use IIS. Everything works fine in IIS express, but when I publish it, especially 1 api request doesn't work. The url I am trying to access API/[Controller]/{date}/{integer}. I keep getting a 500 server error.

ASP.NET Core WebAPI 500 Internal Error in IIS 7.5

james I am trying to get this WebAPI to work. Well, use IIS. Everything works fine in IIS express, but when I publish it, especially 1 api request doesn't work. The url I am trying to access API/[Controller]/{date}/{integer}. I keep getting a 500 server error.

ASP.NET IIS Application 500 Internal Server Error

Moon Ninja I have a very strange problem. I have a development environment where I develop an ASP.NET MVC application and everything works fine in this environment. In particular there is an AJAX call in the Application that calls the controller and passes the

ASP.NET 5 IIS 500 error with EF7 application

Rays I have an application hosted in IIS 8, developed in ASP.NET 5, MVC 6 and EF7. I've created an API for the app to be accessible via and http://localhost/apialso created some controllers to access the data. When I access the API from Visual Studio everythin

ASP.NET 5 IIS 500 error with EF7 application

Rays I have an application hosted in IIS 8, developed in ASP.NET 5, MVC 6 and EF7. I've created an API for the app to be accessible via and http://localhost/apialso created some controllers to access the data. When I access the API from Visual Studio everythin

ASP.NET 5 IIS 500 error with EF7 application

Rays I have an application hosted in IIS 8, developed in ASP.NET 5, MVC 6 and EF7. I've created an API for the app to be accessible via and http://localhost/apialso created some controllers to access the data. When I access the API from Visual Studio everythin

ASP.NET 5 IIS 500 error with EF7 application

Rays I have an application hosted in IIS 8, developed in ASP.NET 5, MVC 6 and EF7. I've created an API for the app to be accessible via and http://localhost/apialso created some controllers to access the data. When I access the API from Visual Studio everythin

ASP.NET 5 IIS 500 error with EF7 application

Rays I have an application hosted in IIS 8, developed in ASP.NET 5, MVC 6 and EF7. I've created an API for the app to be accessible via and http://localhost/apialso created some controllers to access the data. When I access the API from Visual Studio everythin

ASP.NET 5 IIS 500 error with EF7 application

Rays I have an application hosted in IIS 8, developed in ASP.NET 5, MVC 6 and EF7. I've created an API for the app to be accessible via and http://localhost/apialso created some controllers to access the data. When I access the API from Visual Studio everythin

ASP.NET 5 IIS 500 error with EF7 application

Rays I have an application hosted in IIS 8, developed in ASP.NET 5, MVC 6 and EF7. I've created an API for the app to be accessible via and http://localhost/apialso created some controllers to access the data. When I access the API from Visual Studio everythin

ASP.NET 5 IIS 500 error with EF7 application

Rays I have an application hosted in IIS 8, developed in ASP.NET 5, MVC 6 and EF7. I've created an API for the app to be accessible via and http://localhost/apialso created some controllers to access the data. When I access the API from Visual Studio everythin

ASP.NET 5 IIS 500 error with EF7 application

Rays I have an application hosted in IIS 8, developed in ASP.NET 5, MVC 6 and EF7. I've created an API for the app to be accessible via and http://localhost/apialso created some controllers to access the data. When I access the API from Visual Studio everythin

ASP.NET Core hosting - 500 Internal Server Error

username I'm trying to publish as an ASP.NET Core project using a hosting provider that supports ASP.NET Core. I get a 500 Internal Server Error, which is pretty common. So I searched on the internet and various forums and checked processPath="%LAUNCHER_PATH%"

ASP.NET Core hosting - 500 Internal Server Error

username I'm trying to publish as an ASP.NET Core project using a hosting provider that supports ASP.NET Core. I get a 500 Internal Server Error, which is pretty common. So I searched on the internet and various forums and checked processPath="%LAUNCHER_PATH%"

ASP.NET Core hosting - 500 Internal Server Error

username I'm trying to publish as an ASP.NET Core project using a hosting provider that supports ASP.NET Core. I get a 500 Internal Server Error, which is pretty common. So I searched on the internet and various forums and checked processPath="%LAUNCHER_PATH%"

ASP.NET Core hosting - 500 Internal Server Error

username I'm trying to publish as an ASP.NET Core project using a hosting provider that supports ASP.NET Core. I get a 500 Internal Server Error, which is pretty common. So I searched on the internet and various forums and checked processPath="%LAUNCHER_PATH%"

ASP.NET Core hosting - 500 Internal Server Error

username I'm trying to publish as an ASP.NET Core project using a hosting provider that supports ASP.NET Core. I get a 500 Internal Server Error, which is pretty common. So I searched on the internet and various forums and checked processPath="%LAUNCHER_PATH%"

ASP.NET Core hosting - 500 Internal Server Error

username I'm trying to publish as an ASP.NET Core project using a hosting provider that supports ASP.NET Core. I get a 500 Internal Server Error, which is pretty common. So I searched on the internet and various forums and checked processPath="%LAUNCHER_PATH%"

ASP.NET Core Web API 500 Internal Server Error

Fear I am trying to build an API within the ASP.NET Core framework. I made a basic controller that just returns a string: namespace Dojo_Api.Controllers.Forum { //[Authorize] [Route("api/[controller")] public class ForumController : Controller

asp.net core application. 500 Internal Server Error

David Edel I uploaded my website to godaddy windows hosted with plesk. All files are uploaded but I get an error: 500 Internal Server Error. There is a problem with the resource you are looking for and cannot be displayed. By researching the problem online, I