0

I'm a beginner in ASP.NET and in the web config file get the this error:

web config section must only appear once per config file

My web config file:

<system.web>
    <httpRuntime maxRequestLength="1048576" executionTimeout="3600" />
    <httpHandlers>
      <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
    </httpHandlers>
    <pages>
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </controls>
    </pages>
    <compilation targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </assemblies>
    </compilation>
    <httpRuntime/>
  </system.web>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4" compilerOptions="/langversion:4 /nowarn:1659;1699;1701">
          <providerOption name="CompilerVersion" value="v4.0"/>
      </compiler>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
    </compilers>
  </system.codedom>
  <connectionStrings>
    <add name="myCaseLoginEntities" connectionString="metadata=res://*/MyEntity.LoginModel.csdl|res://*/MyEntity.LoginModel.ssdl|res://*/MyEntity.LoginModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.;initial catalog=myCase;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient"/>
    <add name="myCaseConnectionString" connectionString="Data Source=.;Initial Catalog=myCase;Integrated Security=True" providerName="System.Data.SqlClient"/>
    <add name="CaseManagementConnectionString" connectionString="Data Source=.;Initial Catalog=CaseManagement;Integrated Security=True" providerName="System.Data.SqlClient"/>
  </connectionStrings>

I added this line to that file:

<httpRuntime maxRequestLength="1048576" executionTimeout="3600" />

Before that I did not have any errors. How can I solve that problem Thanks.

2
  • Maybe because you declarere it twice as self-closing? Commented Aug 7, 2016 at 11:58
  • If only error messages would say what was wrong. Commented Aug 7, 2016 at 12:14

1 Answer 1

3

You have section httpRuntime twice in your config file:

<httpRuntime maxRequestLength="1048576" executionTimeout="3600" />

and

<httpRuntime/>

Just like it says in the error message that you posted, section must only appear once per config file. So in order to fix the issue remove one of the httpRuntime sections and configuration file should be valid.

Sign up to request clarification or add additional context in comments.

2 Comments

you say remove the <httpRuntime maxRequestLength="1048576" executionTimeout="3600" />? line?
@behzadrazzaqi You need to remove one of two lines that I mentioned - either one, or another.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.