配置错误

时间:2009-03-19 07:23:12

标签: asp.net configuration web-config

运行我的asp.net应用程序时出现以下错误。

服务器错误。
  

“配置错误说明:An   处理过程中出错   需要的配置文件   服务这个请求。请查阅   下面的具体错误详情和   修改配置文件   适当。

     

分析器错误消息:子节点没有   允许的。

来源错误:

Line 126:       <compilers>
Line 127:           <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
Line 128:               <providerOption name="CompilerVersion" value="v3.5"/>
Line 129:               <providerOption name="WarnAsError" value="false"/>
Line 130:           </compiler>

源文件:D:\ ASPMass_Source.0.1 \ ASPMassShop \ web.config行:128


版本信息:Microsoft .NET Framework版本:2.0.50727.42; ASP.NET版本:2.0.50727.42“

以下是我的web.config

<?xml version="1.0"?>
<configuration>
    <configSections>
        <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/>
        <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
            <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                    <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
                    <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                    <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                    <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                </sectionGroup>
            </sectionGroup>
        </sectionGroup>
    </configSections>
    <RewriterConfig>
        <Rules>
            <RewriterRule>
                <LookFor>^/default\.aspx$</LookFor>
                <SendTo>/default.aspx</SendTo>
            </RewriterRule>
            <RewriterRule>
                <LookFor>^/([a-zA-Z0-9-]+)\.aspx$</LookFor>
                <SendTo>/Categories/Category.aspx?Category=$1</SendTo>
            </RewriterRule>
            <RewriterRule>
                <LookFor>^/([a-zA-Z0-9-]+)/([0-9]+)\.aspx$</LookFor>
                <SendTo>/Categories/Category.aspx?Category=$1&amp;PageID=2</SendTo>
            </RewriterRule>
            <RewriterRule>
                <LookFor>^/([a-zA-Z0-9-]+)/([0-9]+)/(NameDown|NameUp|PriceDown|PriceUp)\.aspx$</LookFor>
                <SendTo>/Categories/Category.aspx?Category=$1&amp;PageID=$2&amp;Sort=$3</SendTo>
            </RewriterRule>
            <RewriterRule>
                <LookFor>^/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)\.aspx$</LookFor>
                <SendTo>/Products/Product.aspx?Category=$1&amp;Item=$2</SendTo>
            </RewriterRule>
        </Rules>
    </RewriterConfig>
    <appSettings>
        <add key="SiteName" value="ASPMass Shopping Cart"/>
        <add key="SiteUrl" value="http://localhost:3156"/>
        <add key="SiteDir" value="E:\work\ASPMass\ASPMassShop"/>
        <add key="Currency" value="USD"/>
        <add key="ProductsPerPage" value="10"/>
        <add key="PayPal_Email" value="yourpaypalemail@youremail.com"/>
        <add key="PayPal_Return" value="http://localhost:2324/Orders/OrderStep4.aspx"/>
        <add key="PayPal_Cancel" value="http://localhost:3156/Orders/Payment/Payment.aspx?Payment=PayPal"/>
        <add key="PayPal_Currency" value="USD"/>
        <add key="PayPal_URL" value="https://www.sandbox.paypal.com/cgi-bin/webscr"/>
        <add key="MaxTopProducts" value="100"/>
        <add key="Version" value="0.2"/>
        <add key="ActivateNewUsers" value="True"/>
        <add key="SearchExpiration" value="1440"/>
        <add key="CatImgWidth" value="40"/>
        <add key="CatImgHeight" value="40"/>
        <add key="ManufImgWidth" value="70"/>
        <add key="ManufimgHeight" value="30"/>
        <add key="SMTPServer" value="localhost"/>
        <add key="SMTPPort" value="25"/>
        <add key="SMTPUser" value="admin"/>
        <add key="SMTPPass" value="admin"/>
        <add key="NewsletterEmail" value="no_reply@aspmass.com"/>
    </appSettings>
    <connectionStrings>
        <!--<add name="CartDBConnection" connectionString="Data Source=HAMBUGADA\SQLEXPRESS;Initial Catalog=ASPMass;Integrated Security=True" providerName="System.Data.SqlClient"/>-->
        <add name="ConnStr" connectionString="Data Source=GRAPHIX\SQLEXPRESS;Initial Catalog=GltzCartData;Integrated Security=True " providerName="System.Data.SqlClient"/>
    </connectionStrings>
    <system.web>
        <siteMap>
            <providers>
                <add name="AdminSiteMap" type="System.Web.XmlSiteMapProvider" siteMapFile="~/Admin/Admin.sitemap"/>
            </providers>
        </siteMap>
        <!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.
        -->
        <compilation debug="true">
            <assemblies>
                <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System.Data.DataSetExtensions, 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.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            </assemblies>
        </compilation>
        <!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
        <authentication mode="Windows"/>
        <!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
        <pages theme="Front_BlueTheme">
            <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"/>
            <add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter"/>
        </httpModules>
    </system.web>
    <system.codedom>
        <compilers>
            <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
                <providerOption name="CompilerVersion" value="v3.5"/>
                <providerOption name="WarnAsError" value="false"/>
            </compiler>
        </compilers>
    </system.codedom>
    <!-- 
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
    -->
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <modules>
            <remove name="ScriptModule"/>
            <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        </modules>
        <handlers>
            <remove name="WebServiceHandlerFactory-Integrated"/>
            <remove name="ScriptHandlerFactory"/>
            <remove name="ScriptHandlerFactoryAppServices"/>
            <remove name="ScriptResource"/>
            <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        </handlers>
    </system.webServer>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>

我必须在哪里进行更改才能运行我的应用程序?

3 个答案:

答案 0 :(得分:4)

providerOption不允许作为web.config的编译器标记中的子节点。

<system.codedom>
    <compilers>
            <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
                    <providerOption name="CompilerVersion" value="v3.5"/>
                    <providerOption name="WarnAsError" value="false"/>
            </compiler>
    </compilers>
</system.codedom>

有关.NET 3.5框架的信息,请参阅here on the MSDN docmentation

答案 1 :(得分:3)

错误页面几乎可以告诉您错误的位置以及导致错误的原因。

我认为providerOption不是框架2.0版中compiler元素的有效子元素。从您发布的信息中可以明显看出,您的应用程序已映射到2.0版。如果这是一个问题,您应该考虑将脚本映射重新映射到v.3.x。

AFAIK,此元素仅适用于.NET v3.x及更高版本。

答案 2 :(得分:0)

我刚刚发布了这个问题,然后,在我发现子弹之后my solution。简而言之,3.5站点需要将provider选项元素标记为三个,服务器模式文件由于某种原因没有那个有效,将自己的文件放在它旁边,它似乎正在工作。