之前已经问过这个问题,但是我已经按照给出的答案中列出的所有步骤进行了操作,但仍然会出现同样的错误。
我在Windows Server 2003上安装了IIS 6.0。我在wwwroot文件夹中创建了一个子文件夹,其中包含我的web.config文件,.cs文件,html文件和aspx文件。 我使用IIS管理器将子文件夹设置为应用程序。 一切都在2个月前工作正常。从那时起,我一直忙于其他项目,没有时间完成这项工作。
我现在已经回去完成项目,但是我收到错误(引用web.config文件中的行: 在应用程序级别之外使用注册为allowDefinition ='MachineToApplication'的部分是错误的。
确认: 1.此特定文件夹中没有包含web.config文件的子文件夹。父文件夹中也没有web.config文件。 2.子文件夹被列为应用程序(IIS>网站>(我的网站)>属性>主目录>应用程序设置)
我的所有文件都是在文本编辑器中编码的,直到最近才开始工作......
还有其他可能的问题吗?
如果有帮助,相同的IP地址当前托管另一个站点,该站点位于wwwroot下的自己的子文件夹中。第二个站点有自己的web.config文件,没有任何问题。
如果有帮助,这是我的web.config文件内容(删除了注释):
<configuration>
<appSettings>
<add key="UserMustChangePasswordAtNextLogon" value="true"/>
<add key="UnlockAccountWhenResettingPassword" value="true"/>
<add key="DefaultPassword" value=""/>
</appSettings>
<connectionStrings/>
<system.web>
<compilation debug="true" urlLinePragmas="true">
<assemblies>
<add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<authentication mode="Windows"/>
<identity impersonate="false"/>
<authorization>
<deny users="?" />
</authorization>
<customErrors mode="Off"/>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
<system.codedom>
</system.codedom>
<system.webServer>
</system.webServer>
</configuration>
答案 0 :(得分:0)
如果您正在预编译视图,则可能会遇到此问题。清理您的解决方案以清除问题(您甚至可能需要强制删除bin和obj文件夹)。
当然,您在清理后构建解决方案。 :)
答案 1 :(得分:0)
我带了你的web.config内容,只是删除了deny users标签。 web.config适合我。
尝试创建另一个应用程序并在IIS中托管它。看看是否有效。如果是,请将现有文件夹中的所有文件复制到新的Application文件夹中。