19

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

Community
  • 1
  • 1
Jason Coyne
  • 6,509
  • 8
  • 40
  • 70

9 Answers9

16

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
theforce
  • 1,505
  • 1
  • 11
  • 13
  • I tried these steps myself as well, but it did not work for me. Thanks for the good answer though! – Jason Coyne Jul 09 '12 at 12:57
  • 2
    If you are using Visual Studio 2015, the applicationhost.config is present inside your solution folder. See [this] (http://stackoverflow.com/a/41208195/1977871) – VivekDev Dec 18 '16 at 12:12
  • I had this same issue on VS 2013. This solution worked for me, only after renaming the file and starting VS again, I didn't get a dialog from IISExpress. I just pressed F5 and it worked. – Totoro53 Jan 25 '17 at 10:11
  • 1
    It did create a new applicationhost.config file. That's a cool way to ensure that the IIS Express config is reset to the defaults. Sadly that didn't solve my status code 500 problem. – RonC Jan 11 '23 at 16:32
14

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>

....
...
..
.
uzay95
  • 16,052
  • 31
  • 116
  • 182
5

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

Aaron Hoffman
  • 6,604
  • 8
  • 56
  • 61
4

reinstalling iis express appears to have resolved this problem

Jason Coyne
  • 6,509
  • 8
  • 40
  • 70
1

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?

Basic
  • 26,321
  • 24
  • 115
  • 201
1

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

Protector one
  • 6,926
  • 5
  • 62
  • 86
0

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. :)

Wowe
  • 482
  • 5
  • 15
0

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.

user2128898
  • 101
  • 1
  • 3
0

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

Markus
  • 1,020
  • 14
  • 18