这可能是很多事情的问题,但我试图在我的 IIS 设置或 web.config 配置中缩小问题的根源。这就是我需要你帮助的地方。我将在下面解释我的设置。通常我在 IIS 7 中创建网站,而不是虚拟目录,但我的根目录中有一堆共享的 JavaScript 框架(现在未缩小),并且我有一堆共享这些文件的应用程序。
我的理论是我没有网站本身的配置。网站的路径是虚拟目录路径上方的文件夹。有些东西告诉我我需要这个,但我不记得它需要什么样子。
想法?
请注意,此设置在 Windows XP 虚拟目录设置中运行良好。但我在 Windows 7 和 Windows Server 2008 上都收到此错误。
这是网站错误:
文本错误(用于搜索):
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" />
网址:
http://localhost/app/index.aspx
在我的应用程序池(虚拟目录所在的站点)中更改了这 3 个设置:
禁用“匿名身份验证”并启用“Windows 身份验证”:
虚拟目录文件夹(网站的子文件夹)中的 web.config 文件:
<?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>