加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

IIS 7中的虚拟目录ASP.NET网站的配置错误

发布时间:2020-12-16 07:17:40 所属栏目:asp.Net 来源:网络整理
导读:这可能是许多问题,但我试图在IIS设置或web.config配置中缩小问题的来源.这就是我需要你帮助的地方.我将在下面解释我的设置.通常我在IIS 7中创建网站,而不是虚拟目录,但我的根目录中有一堆共享的 JavaScript框架(现在没有通知),我有一堆共享这些文件的应用程
这可能是许多问题,但我试图在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=SERVERNAMESQLEXPRESS;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>

解决方法

您必须在IIS中将虚拟目录配置为“应用程序”

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读