各位大哥:
我刚才照着书上写了个程序:
我按 Ctrl+Shit+B  编译项目没有错误 (Build: 1 succeeded, 0 failed, 0 skipped)可是我按 Ctrl+F5 运行程序,则出现下面的错误:*********************************************************************错误提示Server Error in '/DEMO/CH2' Application.
--------------------------------------------------------------------------------Configuration Error 
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: The data at the root level is invalid. Line 1, position 1.Source Error: 
Line 1:  .<?xml version="1.0" encoding="utf-8" ?>
Line 2:  <configuration>
Line 3:      
 Source File: c:\inetpub\wwwroot\DEMO\CH2\web.config    Line: 1 
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573 *****************************************************************************错误提示
各位大哥,我是不是有什么地方还没有配置好!
配置文件为:<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    
  <system.web>    <!--  DYNAMIC DEBUG COMPILATION
          Set compilation debug="true" to enable ASPX debugging.  Otherwise, setting this value to
          false will improve runtime performance of this application. 
          Set compilation debug="true" to insert debugging symbols (.pdb information)
          into the compiled page. Because this creates a larger file that executes
          more slowly, you should set this value to true only when debugging and to
          false at all other times. For more information, refer to the documentation about
          debugging ASP.NET files.
    -->
    <compilation 
         defaultLanguage="c#"
         debug="true"
    />    <!--  CUSTOM ERROR MESSAGES
          Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable. 
          Add <error> tags for each of the errors you want to handle.          "On" Always display custom (friendly) messages.
          "Off" Always display detailed ASP.NET error information.
          "RemoteOnly" Display custom (friendly) messages only to users not running 
           on the local Web server. This setting is recommended for security purposes, so 
           that you do not display application detail information to remote clients.
    -->
    <customErrors 
    mode="RemoteOnly" 
    />     <!--  AUTHENTICATION 
          This section sets the authentication policies of the application. Possible modes are "Windows", 
          "Forms", "Passport" and "None"          "None" No authentication is performed. 
          "Windows" IIS performs authentication (Basic, Digest, or Integrated Windows) according to 
           its settings for the application. Anonymous access must be disabled in IIS. 
          "Forms" You provide a custom form (Web page) for users to enter their credentials, and then 
           you authenticate them in your application. A user credential token is stored in a cookie.
          "Passport" Authentication is performed via a centralized authentication service provided
           by Microsoft that offers a single logon and core profile services for member sites.
    -->
    <authentication mode="Forms">
    <forms loginURL="webform1.aspx"/>
    </authentication> <!--  AUTHORIZATION 
          This section sets the authorization policies of the application. You can allow or deny access
          to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous 
          (unauthenticated) users.
    -->    <authorization>
        <deny users="?"/>
    </authorization>    <!--  APPLICATION-LEVEL TRACE LOGGING
          Application-level tracing enables trace log output for every page within an application. 
          Set trace enabled="true" to enable application trace logging.  If pageOutput="true", the
          trace information will be displayed at the bottom of each page.  Otherwise, you can view the 
          application trace log by browsing the "trace.axd" page from your web application
          root. 
    -->
    <trace
        enabled="false"
        requestLimit="10"
        pageOutput="false"
        traceMode="SortByTime"
localOnly="true"
    />    <!--  SESSION STATE SETTINGS
          By default ASP.NET uses cookies to identify which requests belong to a particular session. 
          If cookies are not available, a session can be tracked by adding a session identifier to the URL. 
          To disable cookies, set sessionState cookieless="true".
    -->
    <sessionState 
            mode="InProc"
            stateConnectionString="tcpip=127.0.0.1:42424"
            sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
            cookieless="false" 
            timeout="20" 
    />    <!--  GLOBALIZATION
          This section sets the globalization settings of the application. 
    -->
    <globalization 
            requestEncoding="utf-8" 
            responseEncoding="utf-8" 
   />
   
 </system.web></configuration>谢谢各位大哥!

解决方案 »

  1.   


    设置虚拟目录 ch2 指向 c:\inetpub\wwwroot\DEMO\CH2c:\inetpub\wwwroot 目录下是否有web.config ,有则先改个其它的名字再调试看看
      

  2.   

    同意上面老兄得说法。设置虚拟目录 ch2 指向 c:\inetpub\wwwroot\DEMO\CH2c:\inetpub\wwwroot 目录下是否有web.config ,有则先改个其它的名字再调试看看
      

  3.   

    .<?xml version="1.0" encoding="utf-8" ?>前面多了一个.
    这是不合乎xml规范的
      

  4.   

    还是孟老大厉害,
    Source File: c:\inetpub\wwwroot\DEMO\CH2\web.config    Line: 1 
    已经提示的很清楚了
      

  5.   

    谢谢各位大哥:
    我的程序是放在
     C:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\CH2我右击 CH2---》属性,可是只有:常规,WEB 共享,共享,安全 。这四个选项,没有目录啊?是不是我选的地方错了,我不是在 visual studio  里设置的?请教各位大哥:
    我错在哪里啊?谢谢!
      

  6.   

    去掉那个 . 
    还是有错
     
       <authentication mode="Forms">
        <forms loginURL="webform1.aspx"/>
        </authentication>提示:
    <forms loginURL="webform1.aspx"/>有错误!谢谢各位大哥!
      

  7.   

    如果没有安全选项那说明你的盘不是NTFS格式的。你在共享中去设吧。
      

  8.   

    luckyprg 大哥:
    请您再详细说一下啊,我的有安全选项啊,我的 C 盘NTFS格式的可是 常规,WEB 共享,共享,安全 ,这四个选项,都没有设置虚拟目录的啊~~谢谢!
      

  9.   

    在IIS里找到你的这个虚拟目录,然后>>-属性-目录-点“应用程序名”后面的“创建”按钮。
    如果还有问题再问.
      

  10.   

    renyu732 大哥:
     您好!我在 IIS 里找到了 CH2  了
    我右击 属性--》目录
    可是我的  应用程序名  后面是一个 “删除”按钮 
    下面还有个 配置  按钮
    我的 应用程序名 的  TEXT  是空白的 renyu732 大哥,是不是 单击 配置按钮啊/谢谢!