Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuration Error in IIS 7 for Virtual Directory ASP.NET website

This could be an issue with many things, but I'm trying to narrow down the source of the issue in my IIS setup or web.config configuration. That's where I need your help. I will explain my setup below. Normally I create web sites in IIS 7, and not virtual directories, but I have a bunch of shared JavaScript frameworks in my root directory (unminified right now), and I have a bunch of applications sharing those files.

My theory is that I do not have configuration for the web site itself. The path of the web site is the folder above the virtual directory path. Something tells me I need this, but I don't remember what it needs to look like.

Thoughts?

Note, this setup works just fine in Windows XP virtual directory setup. But I get this error on both Windows 7 and Windows Server 2008.

Here is the website error:

enter image description here

Error in text (for searching):

Server Error in '/' Application.

Configuration Error

Descriptionn: An error occurred during the processing of a configuration file required to service this request.  Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.

Source Error:

<compilation debug=true" targetFramework="4.0" />

Website URL:

http://localhost/app/index.aspx

Changed these 3 settings in my app pool (of the site in which the virtual directory resides in):

enter image description here

Disabled 'Anonymous Authentication' and Enabled 'Windows Authentication':

enter image description here

web.config file in virtual directory folder (sub folder of web site):

<?xml version="1.0" encoding="UTF-8"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>

    <configSections>
    </configSections>

    <connectionStrings>
        <!-- Local Machine -->
        <add name="DATABASE" connectionString="Data Source=SERVERNAME\SQLEXPRESS;Initial Catalog=DATABASE-DEV;User ID=sa;Password=xxx" providerName="System.Data.SqlClient" />

    </connectionStrings>

    <!--<dataConfiguration defaultDatabase="DataAccessQuickStart">
    <providerMappings>
      <add databaseType="Devart.Data.Oracle.EnterpriseLibrary.OracleDatabase,Devart.Data.Oracle.EnterpriseLibrary" name="OracleX" />
    </providerMappings>
  </dataConfiguration>-->
    <!--<location path="." allowOverride="true">
  </location>-->
    <system.web>
        <compilation debug="true" targetFramework="4.0" />

        <authentication mode="Windows" />
        <authorization>
            <deny users = "?" />
        </authorization>

        <membership>
            <providers>
                <clear />
                <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
            </providers>
        </membership>

        <profile>
            <providers>
                <clear />
                <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
            </providers>
        </profile>

        <roleManager enabled="false">
            <providers>
                <clear />
                <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
                <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
            </providers>
        </roleManager>

        <webServices>
            <protocols>
                <add name="HttpGet" />
                <add name="HttpPost" />
            </protocols>
        </webServices>

        <trace writeToDiagnosticsTrace="true" enabled="true" pageOutput="false" />


    </system.web>
    <appSettings>
    </appSettings>

    <!--<identity impersonate="true" />-->

    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
    </system.webServer>
</configuration>
like image 399
MacGyver Avatar asked Aug 08 '13 20:08

MacGyver


1 Answers

You have to configure the virtual directory as 'application' in IIS

like image 126
Stephen Avatar answered Sep 22 '22 23:09

Stephen