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 everything works fine and I am able to retrieve the JSON data. However, when I host the application IIS 8 and the browser, I get localhost/api/controlleran 500error in the IIS log. I have also http platform handler 1.2installed on Windows Server 2012 R2 server. Actually, I am able to browse static pages and other links, for example localhost/home, but when I try to access the api controller I get a 500 error code.

Now when I self-host the app and browse it using web.cmdthe executable from the app localhost:5000/api/controller, I can retrieve the json data back from the json hosting site.

Since I don't know what the problem is, I enabled the feature Failed request tracing rulesand was able to capture the log for 500 errors. Below is the screenshot:

enter image description hereenter image description hereenter image description hereenter image description hereenter image description hereenter image description hereenter image description hereenter image description hereenter image description here

Daniel Lesser

Can't get this message from the failed request log, but since you say it works outside of IIS, I might suggest the usual skeptics:

  1. Confirm that the application pool is set up to work with .NET 5.0 and not set to another CLR (like 2.0 or 4.0). ( Actually it does, because in this case non-API MVC controllers simply won't work... )

  2. If using NTLM security with SQL, verify that the application pool is running with an account with sufficient database permissions, as the execution context may be different when running IIS Express from Visual Studio vs. IIS.

I would also recommend checking the Windows error log, not just the request trace....

Related


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 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

HTTP 500 error with ASP.NET Core application on IIS Express 10

Numirani I believe I have narrowed it down to a misconfiguration, but I can't find where the error lies. Steps to reproduce: Created a new project in Jetbrains Rider 2020.3. ASP.NET Core web application, Windows Authentication. Let the new project build itself

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.

Deploying ASP.NET Core API to local IIS error 500

Michael Reno Platama Setavan I have a problem with my application after deploying to local IIS. I've made an API using ASP.NET Core and have run it on Visual Studio and it works. It can perform GET, POST, PUT and DELETE requests. Then I want to deploy it to lo

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

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 erro

Deploying ASP.NET Core API to local IIS error 500

Michael Reno Platama Setavan I have a problem with my application after deploying to local IIS. I've made an API using ASP.NET Core and have run it on Visual Studio and it works. It can perform GET, POST, PUT and DELETE requests. Then I want to deploy it to lo

ASP.NET Core MVC causes 500 error on IIS 8.5

Mickey Using .NET Core 3.1, I developed an MVC application and deployed it on IIS 8.5. Using a browser, I can go to the home page when I visit, domain.com/myApp/but I get an http 500 error when I visit domain.com/myApp. This is working locally. The problem occ

Deploying ASP.NET Core API to local IIS error 500

Michael Reno Platama Setavan I have a problem with my application after deploying to local IIS. I've made an API using ASP.NET Core and have run it on Visual Studio and it works. It can perform GET, POST, PUT and DELETE requests. Then I want to deploy it to lo

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.