ASP.NET MVC4 nicht rendering-layouts in IIS

Arbeiten mit ASP.NET und MVC für ein paar Jahre und noch nie gesehen davor...

Nur erhielt eine neue Maschine. Erstellt ein neues MVC4-Projekt (für das Internet, in den Assistenten). Ich bin mit dem Projekt "out of the box" zu testen, dass alles eingerichtet ist und ordnungsgemäß konfiguriert.

Wenn ich es aus Visual Studio (2010) mit dem eingebauten web-server, dann ist alles in Ordnung. Jedoch, ich habe eine Anwendung in IIS, und es ist nicht der Darstellung des Layouts (Standard-generierten code in die Standard-Speicherort unter " ~/Views/Shared/_Layout.cshtml) butI tun, um den Index.cshtml (~/Views/Home/Index.cshtml) Inhalt. Nichts aus dem layout dargestellt wird: keine html-Tags, keine Stile, keine javascript, keine body-Tags, nichts.

Haben die grundlegende Diagnose... Kein server-Fehler auf, zeigt sich in IIS. Nichts protokolliert einen Fehler im Ereignis - /Anwendungs-log. Nichts zeigt sich in der Chrome-network inspector-tool (auch nicht 404 oder 500er).

Irgendwelche Ideen? Da bin ich überfragt... habe das Gefühl es ist etwas sehr, sehr einfach.

Index.cshtml (standardmäßig generiert code, außer für meine test-code an der Unterseite, nur um sicherzustellen, dass die MVC dlls abgeholt wurden korrekt):

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

Gemacht in Chrom:

<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>
  • Es könnte ein permission-Problem, wo der Benutzer die Verwendung von IIS zum ausführen Ihrer app-pool hat keinen Zugriff auf diese Datei.
  • Ich nehme einen Blick auf diese und Bericht zurück.
  • Ja, gerade überprüft und Berechtigungen korrekt erscheinen.
  • Nick, du hast vollkommen Recht! Ich patzte auf die Berechtigungen für das IUSR-Konto (facepalm). Danke!
InformationsquelleAutor longda | 2013-02-27
Schreibe einen Kommentar