我用web matrix作为开发环境.运用code behind编写代码,如果有web.config文件则运行时:
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: 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 44:            它为成员站点提供单独登录和核心配置文件服务。
Line 45:     -->
Line 46:     <authentication mode="Windows" /> 
Line 47: 
Line 48:  <!--  授权 
 Source File: C:\Documents and Settings\Administrator\My Documents\Chapter14\DataSetExample\web.config    Line: 46 要是没有web.config文件,则运行时:
Parser Error 
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Could not load type 'DataSetExample.WebForm1'.Source Error: 
Line 1:  <%@ Page Language="c#" codebehind="1.aspx.cs" autoeventwireup="false" Inherits="DataSetExample.WebForm1" %>
Line 2:  <html>
Line 3:  <head>
 Source File: C:\Documents and Settings\Administrator\My Documents\Chapter14\DataSetExample\1.aspx    Line: 1 保证代码没有问题,一个文件是1.aspx,一个是1.aspx.cs

解决方案 »

  1.   

    在web.config所在的虚拟目录没有创建应用程序池。此时Asp.NET仍然可以运行,只要该虚拟目录的父目录中有应用程序池,但在该目录的位置就不能有配置文件,并且该目录下的bin子目录也将被忽略。
      

  2.   

    楼上说的我看不懂啊!能不能说得通俗一些?
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        
      <system.web>   
        <compilation 
             defaultLanguage="c#"
             debug="true"
        />  
        <customErrors 
        mode="RemoteOnly" 
        />    
     
        <authentication mode="Windows" /> 
        <authorization>
            <allow users="*" /> 
                
        </authorization>  
        <trace
            enabled="false"
            requestLimit="10"
            pageOutput="false"
            traceMode="SortByTime"
    localOnly="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 
                requestEncoding="utf-8" 
                responseEncoding="utf-8" 
       />
       
     </system.web></configuration>
      

  3.   

    打开IIS,在web.config文件所在的目录上按右键,在应用程序设置中点击创建按钮,即可为这个目录创建一个应用程序池。
      

  4.   

    看了你的Web.Config文件,没有什么会让程序必须依赖的内容。
    而你用的是web matrix开发,很可能就如 Ivony() 所说,是应用程序池配置上的问题。这个方面我不是很了解了。你和他沟通吧。