Been working with ASP.NET and MVC for a few years and never seen this one before...
Just received a new machine. Created a new MVC4 Web project (for Internet, in the wizard). I'm using the project right "out of the box" to test that everything is setup and configured correctly.
If I run it from Visual Studio (2010) using the built in web server then all is fine. However, I set up an app in IIS and it's not rendering the layout (default generated code in the default location at ~/Views/Shared/_Layout.cshtml) butI do get the Index.cshtml (~/Views/Home/Index.cshtml) content. Nothing from the layout is rendered: no html tag, no styles, no javascript, no body tag, nothing.
Did the basic diagnostics... No server errors showing up in IIS. Nothing logged as an error in the event/application log. Nothing showing up in the Chrome network inspector tool (not even 404s or 500s).
Any ideas? I'm stumped... have the feeling its something very, very simple.
Index.cshtml (default generated code except for my test code at the bottom, just to make sure the MVC dlls were picked up correctly):
<h3>We suggest the following:</h3>
<ol class="round">
<li class="one">
<h5>Getting Started</h5>
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
enables a clean separation of concerns and that gives you full control over markup
for enjoyable, agile development. ASP.NET MVC includes many features that enable
fast, TDD-friendly development for creating sophisticated applications that use
the latest web standards.
<a href="http://go.microsoft.com/fwlink/?LinkId=245151">Learn more…</a>
</li>
<li class="two">
<h5>Add NuGet packages and jump-start your coding</h5>
NuGet makes it easy to install and update free libraries and tools.
<a href="http://go.microsoft.com/fwlink/?LinkId=245153">Learn more…</a>
</li>
<li class="three">
<h5>Find Web Hosting</h5>
You can easily find a web hosting company that offers the right mix of features
and price for your applications.
<a href="http://go.microsoft.com/fwlink/?LinkId=245157">Learn more…</a>
</li>
</ol>
@foreach(var i in new int[]{1,2,3,4,5})
{
<div>Test @i.ToString()</div>
}
Rendered in Chrome:
<h3>We suggest the following:</h3>
<ol class="round">
<li class="one">
<h5>Getting Started</h5>
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
enables a clean separation of concerns and that gives you full control over markup
for enjoyable, agile development. ASP.NET MVC includes many features that enable
fast, TDD-friendly development for creating sophisticated applications that use
the latest web standards.
<a href="http://go.microsoft.com/fwlink/?LinkId=245151">Learn more…</a>
</li>
<li class="two">
<h5>Add NuGet packages and jump-start your coding</h5>
NuGet makes it easy to install and update free libraries and tools.
<a href="http://go.microsoft.com/fwlink/?LinkId=245153">Learn more…</a>
</li>
<li class="three">
<h5>Find Web Hosting</h5>
You can easily find a web hosting company that offers the right mix of features
and price for your applications.
<a href="http://go.microsoft.com/fwlink/?LinkId=245157">Learn more…</a>
</li>
</ol>
<div>Test 1</div>
<div>Test 2</div>
<div>Test 3</div>
<div>Test 4</div>
<div>Test 5</div>