Jason Coyne
Jason Coyne

Reputation: 6636

Why am I getting error 500.0 in when using IIS Express (significant debug info included)

I created a blank MVC 3 application on VS2010 SP1, and set the app to use IIS Express. When I debug, I get error 500.0 (0x80070585)

I am able to succesfuly run the app using the VS dev server

I have set the app directory to Full Permissions for Everyone, just to eliminate all possibility of security issues. I have further verified that IIS express is able to hit the web.config by confirming it using SysInternals ProcMon. ProcMon does not show the IISExpress process attempting to read from any other files in my application directory.

I have followed the suggestions in the following question, but it does not give me any better information. HTTP 500 Internal Error - IIS websites

No logs are generated in the IISExpress directory in either the Logs or TraceLogs directory, but a log is created in Temp, however it is not very useful.

Successfully registered URL "http://localhost:62017/" for site "MvcApplication1" application "/"
Registration completed for site "MvcApplication1"
Request ended: http://localhost:62017/ with HTTP status 500.0
Request ended: http://localhost:62017/ with HTTP status 500.0
Request ended: http://localhost:62017/ with HTTP status 500.0

There are no messages I am able to find in the Event Viewer

**Updates : ** Disabled firewall, no change Ran IISExpress via command line, no change

Upvotes: 21

Views: 23922

Answers (9)

Markus
Markus

Reputation: 1211

Look in the logs folder of the application service exe (The visual studio project bin\log or wherever you are logging) that you are running to launch the web server. This has earlier log errors than IIS web call related failures, e.g. Unable to resolve service for type ... Also enable logging in your ASP.NET.Core Startup function since the errors may be happening there that cause the client to receive the Internal Server Error 500 error.

Also enable stdoutLogEnabled="true" in web.config

Upvotes: 0

user2128898
user2128898

Reputation: 101

Just in case catches someone else out, I had similar error but the issue was I had updated my web.config and there was an extra ">" character where it should be.. so malformed web.config file can cause the same behaviour.

Upvotes: 0

Wowe
Wowe

Reputation: 502

In my case the issue was caused by using windows authentication + firefox + wrong domain login with insufficient permissions.

Details: My dev machine is using windows domain "domA", the application will run in an environment accepting logins from domain "domA" and "domB". While on the webserver both will work, on my dev machine only my account in "domA" has sufficient permissions to access all files of the application. In IE "domA" is used by default while in FF I get a login dialog where I did login with my account from "domB".

Confusing issue I know, but maybe there is someone else having the same situation. At least it will help me the next time I run into it. :)

Upvotes: 0

Protector one
Protector one

Reputation: 7261

There might be a problem with your config files, specifically web.config and applicationhost.config.

The only way I know how to diagnose this, is to publish a build to regular IIS, and in IIS Manager check the "Error Pages" module of the Site. If it is indeed an issue with those config files, you'll get a popup here with something along the lines: "Cannot add duplicate entry of type …". Google accordingly.
If the "duplicate entry" is of type "error", you can try adding the following element below httpErrors:

<remove statusCode="404"/>

That is, assuming you have an Error element below the HttpErrors with statusCode 404. (I had once.)

Upvotes: 1

Aaron Hoffman
Aaron Hoffman

Reputation: 6962

This may be related to a conflict between the IIS Express applicationhost.config and your web.config.

A mimeType was added to my local web.config that was already present in the applicationhost.config and IIS Express started serving many 500 errors.

You may also notice this error in your Windows Event Log, "The directory specified for caching compressed content is invalid. Static compression is being disabled."

More info: http://blog.degree.no/2013/04/the-directory-specified-for-caching-compressed-content-is-invalid-static-compression-is-being-disabled/

I removed the mimeTypes from the web.config and the issue was resolved.

applicationhost.config location: C:\Users\[User]\Documents\IISExpress\config

Upvotes: 5

uzay95
uzay95

Reputation: 16622

You may have some mime code in the Web.Config file like this:

<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />

if so, you should remove mimeMap before adding like this:

.
..
...
....
  </system.web>
  <system.webServer>
    <staticContent>
      <remove fileExtension=".svg" />
      <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
    </staticContent>
  </system.webServer>

....
...
..
.

Upvotes: 14

theforce
theforce

Reputation: 1525

I had the same issue last week, the app running perfect in dev web server from VS Studio. But in IISExpress anytime HTTP Error 500. My solution on this time was:

  • close VS Studio - solution set with IISExpress
  • got to: /Document/IISExpress/config/ in your profile
  • rename or delete applicationhost.config
  • open your solution in VS Studio
  • a Dialog will fire up from IISExpress - this will set a fresh config.
  • try to run your web app

Upvotes: 16

Jason Coyne
Jason Coyne

Reputation: 6636

reinstalling iis express appears to have resolved this problem

Upvotes: 4

Basic
Basic

Reputation: 26756

Are you using any PLINQ(.AsParallel) or Parallel.For or similar methods? I've found that the AggregateExceptions they throw aren't handled well by MVC (In my case, I got a blank 500 page and nothing in Logs/Event logs).

I identified the problem by paying attention to the "First Chance" exceptions which are logged in the Debug output window in VS. Try running the site, waiting for it to error, clearing the Debug window and the reloading the page. Do you see anything useful?

Upvotes: 2

Related Questions