web.config allowDefinition = MachineToApplication错误 [英] web.config allowDefinition=MachineToApplication error

查看:55
本文介绍了web.config allowDefinition = MachineToApplication错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在根目录下,我具有以下结构

Under the root directory I have the following structure

..
..
..
web.config
Report Folder
- Login.aspx
- Web.config
  |
  |-> ViewReport
       |       
       |-> Report.aspx

在报告"文件夹中的web.config文件中,我具有以下内容:

In my web.config file in the Report folder I have the following:

    <?xml version="1.0"?>
    <configuration>
        <system.web>
            <authentication mode="Forms">
                <forms loginUrl="Login.aspx" defaultUrl="ViewReport/Report.aspx">
                    <credentials passwordFormat="Clear">
                        <user name="Johl" password="pass888"/>
                    </credentials>
                </forms>
             </authentication>
         </system.web>

        <location path="ViewReport/Report.aspx">
            <system.web>
                <authorization>
                    <allow users="Johl"/>
                    <deny users="*"/>
                </authorization>
            </system.web>
         </location>
     </configuration>

当我开始调试时,我收到以下消息:

When I start debugging I get the following message:

使用超出应用程序级别注册为allowDefinition ='MachineToApplication'的部分是错误的.此错误可能是由于未在IIS中将虚拟目录配置为应用程序引起的.

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.

请注意,在我的根web.config中,我有以下内容:

NOTE that in my root web.config I have something like the following:

在我的根目录下,我已经具备以下条件:

In my root, I already have the following:

         <system.web>        
            <authentication mode="Forms">
                <forms loginUrl="Str/StrUserLogin.aspx" timeout="2880" slidingExpiration="true"  />         
               </authentication>
            <authorization>
                <allow users="*" />
            </authorization>     
         </system.web>

推荐答案

在站点根目录创建一个虚拟目录.可以通过VS标签的"Web"选项卡下的项目属性来完成.

Create a virtual directory at the site root. This can be done via project properties in VS under the Web tab.

也有可能在子目录中定义了应该在根配置文件中的内容.在这里看到类似的问题:

It's also possible that you have things defined in the sub-directory that should be in the root config file. See similar question here:

使用注册为allowDefinition的部分时出错超出应用程序级别的"MachineToApplication"

这篇关于web.config allowDefinition = MachineToApplication错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆