如何解决Web.config中的以下错误

时间:2012-10-03 13:39:39

标签: asp.net

这是运行时发生的错误

Description: 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: 


Line 25:             ASP.NET to identify an incoming user. 
Line 26:         -->
Line 27:        <authentication mode="Forms"/>
Line 28:        <!--
Line 29:             The <customErrors> section enables configuration 

Source File: F:\Final Event Management\event management\web.config    Line: 27 

它是产生错误的编码

<?xml version="1.0"?>

<configuration>
    <appSettings/>
    <connectionStrings/>
    <system.web>

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

        <authentication mode="Forms"/>

        <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>

</configuration>

请解决这个问题.............

1 个答案:

答案 0 :(得分:2)

创建一个虚拟目录,看看是否能解决问题:

How to: Create IIS Virtual Directories in Visual Studio

在“解决方案资源管理器”窗口中右键单击项目节点,然后选择“属性”,然后选择“Web”选项卡,您将看到一个按钮,用于为您的站点创建虚拟目录。