During the upgrade of an old project from netcore2.2 to 3.1, an Ocelot gateway interface program changes the project file
- <TargetFramework>netcoreapp2.2</TargetFramework>
+ <TargetFramework>netcoreapp3.1</TargetFramework>
Replace the Services.Addmvc() in your project:
services.AddMvc(options => { options.EnableEndpointRouting = false; });
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
The method Configure(IApplicationBuilder app, IWebHostEnvironment env) retains the original app.UseMvc();
The compiler passed, but the runtime page reported an error: HTTP Error 500.37 – ANCM Failed to Start Within Startup Time, searched the web for a solution and gave a way to modify the startupTimeLimit value.
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<location>
<system.webServer>
<aspNetCore xdt:Transform="SetAttributes(startupTimeLimit)" startupTimeLimit="300">
</aspNetCore>
</system.webServer>
</location>
</configuration>
The run result page is directly inaccessible.
Solution:
You only need to add a project node
< AspNetCoreHostingModel> OutOfProcess OK.
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>
After doing the above, the project runs normally. In addition, the above services.AddMvc() is not the recommended solution.
AddMvc(); comment out app.UseMvc() in the Configure method; then add the following code.
//app.UseMvc();
app.UseRouting();//add
app.UseEndpoints(endpoints =>//add
{
endpoints.MapControllers();
});
Read More:
- HTTP Error 500.30 – ANCM In-Process Start Failure
- [Solved] Swagger Startup Error: Failed to start bean ‘documentationPluginsBootstrapper‘
- Tomcat startup error: Failed to start component [StandardServer[8005]] solution
- [Solved] Asp.Net Core IIS Error: HTTP Error 500.30 – ASP.NET Core app failed to start
- [Solved] Springboot project Create to start Error: APPLICATION FAILED TO START
- [Solved] integrated swagger Start Error: Failed to start bean ‘documentationPluginsBootstrapper‘;
- [Solved] Xcode13.1 Upgrade Error: CocoaPods installed but not working Failed to build gem native extension
- [Solved] KDevelop Error: Failed to specify program to start
- [Solved] Windows Nginx Startup Error: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket
- How to Solve Project Upgrade to flutter2.5.0 Error
- [Solved] net core HTTP Error 500.31 – Failed to load ASP.NET Core runtime HTTP Error 500.30 – ASP.NET Core
- Flutter upgrade upgrade SDK SSL_ERROR_Syscall error [How to Solve]
- How to Solve Application failed to start error
- How to Solve Hyperf Failed to Start Error After Aliyun ACM Installed
- [Solved] Doris StreamLoad Error: load by MERGE or DELETE need to upgrade table to support batch delete
- How to Fix Node SASS Error in Vue + webpack project after nodejs upgrade
- How to Solve hadoop3.x.x sh start-dfs.sh Startup Error
- New Spring boot startup error Failed to auto-configure a DataSource
- [Solved] Zabbix-server startup error: cannot start alert manager service: Cannot bind socket to “/var/run/zabbix/zabbix_server_alerter.sock”: [13] Permission denied.
- SpringBoot startup error Failed to determine a suitable driver class