![](/img/trans.png)
[英]ASP.NET Core Web API & Entity Framework Core; why am I getting this error?
[英]Why am I getting an error in web config in ASP.NET?
我是ASP.NET的初学者,并且在Web配置文件中出现此错误:
Web配置部分必须在每个配置文件中仅出现一次
我的网络配置文件:
<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=\"Web\" /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="data source=.;initial catalog=myCase;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" 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>
我将此行添加到该文件:
<httpRuntime maxRequestLength="1048576" executionTimeout="3600" />
在此之前,我没有任何错误。 我该如何解决这个问题?
您的配置文件中有两次httpRuntime
部分:
<httpRuntime maxRequestLength="1048576" executionTimeout="3600" />
和
<httpRuntime/>
就像在您发布的错误消息中说的那样,每个配置文件中的部分只能出现一次。 因此,为了解决此问题,请删除httpRuntime
部分之一,并且配置文件应该有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.