Die MVC 4-Anwendung wechselt beim Ausführen zuerst mit Windows-Authentifizierung zur Anmeldeseite

Ich entwickle derzeit ein Projekt, das die Windows-Authentifizierung verwendet, um Benutzer zu autorisieren und ihre spezifischen Berechtigungen festzulegen. Jedes Mal, wenn ich das zu testende Programm ausführe, wird die von Visual Studio beim Erstellen des Projekts erstellte Standardanmeldeseite (/ Account / Login) immer zuerst angezeigt, anstatt zu Start / Index zu wechseln. Die URL lautet normalerweisehttp://localhost:50848/Account/Login?ReturnUrl=%2fViews%2fHome%2fIndex.cshtml wenn ich es starte, anstatt nurhttp://localhost:50848. Ich sollte auch beachten, dass das Programm die richtige Windows-Authentifizierung auf dem Bildschirm erhält, damit ich weiß, dass dieser Teil funktioniert.

Gibt es etwas in meinen Einstellungen, das ich ändern kann, um zu verhindern, dass dieser zusätzliche Anmeldebildschirm angezeigt wird? Ich verwende Visual Studio 2012, IIS Express und MVC 4. Relevanter Code:

Web.config

    <appSettings>
        <add key="webpages:Version" value="2.0.0.0" />
        <add key="webpages:Enabled" value="false" />
        <add key="PreserveLoginUrl" value="false" />
        <add key="ClientValidationEnabled" value="true" />
        <add key="UnobtrusiveJavaScriptEnabled" value="true" />
        <add key="autoFormsAuthentication" value="false" />
        <add key="enableSimpleMembership" value="false"/>
      </appSettings>

<system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    <!--<authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" />
    </authentication>-->
      <authentication mode="Windows"/>
      <authorization>
          <deny users="?"/>
      </authorization>
    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
      </namespaces>
    </pages>
  </system.web>

<system.webServer>
    <validation validateIntegratedModeConfiguration="true" />
    <handlers>
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
  </system.webServer>

IIS Express applicationhost.config

   <authentication>

            <anonymousAuthentication enabled="false" userName="" />

            <basicAuthentication enabled="false" />

            <clientCertificateMappingAuthentication enabled="false" />

            <digestAuthentication enabled="false" />

            <iisClientCertificateMappingAuthentication enabled="false">
            </iisClientCertificateMappingAuthentication>

            <windowsAuthentication enabled="true">
                <providers>
                    <add value="Negotiate" />
                    <add value="NTLM" />
                </providers>
            </windowsAuthentication>

        </authentication>

Und ja, ich habe die Windows-Authentifizierung in "aktiviert" und die anonyme Authentifizierung in "deaktiviert" geändert.

Antworten auf die Frage(4)

Ihre Antwort auf die Frage