HTTP Error 500.30 - ASP.NET Core app failed to start

I was doing a restore to another environment today. The destination db server was using Always on Availability groups.

We use single sign on for our app server configurations.

After preforming the restore and reconfiguring the availability group, regenerating the database and recycling the application pool I was getting the following
“HTTP Error 500.30 - ASP.NET Core app failed to start”, when trying to connect from the application pool, even of more concern I was getting an error when I was testing the connection to the database in the application configuration of:
“The Database xxxxx is not an ice database”

I have never struck this sort of problem before.
Checking the event logs I noticed that the there was an entry in there that mentioned:
“The SELECT permission was denied on the object ‘GlobalSettingAttribute’, database ‘XXXXXXXX’, schema ‘Ice’.”

A comparison between the service account configuration in each sql server showed no difference, setting it as dbo of the application database Resolved the problem. Now I could test the database in the configuration and connect to the database through the test in the application configuration.

Digging deeper turns out there service account on the source server is set to sysadmin role… :thinking:

Anyway I hope someone finds this useful… There was nothing in the Epicare database relating to this error.

Running into a similar issue with 2023.1. Getting the same ASP.NET Core app failed to start error. But in our case in the log is showing a SQL timeout issue. The connection test in the app config is fine and the EAC can access the dB, run the upgrade process, and run a data model regen. But the client won’t connect.

System.Data.SqlClient.SqlException (0x80131904): Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement.

@chaddb You upgraded the Admin console?

Yep - EAC has both 2022 (11.2.200.0) and 2023 (11.2.300.0) components.

Did you try doing a repair on the .Net6 Hosting package?

Check out your SQL server event log, that’s where I discovered my problem, maybe it will shed some light.

Tried that. My 2022 instances on the same app VMs work fine. But 2023 won’t run. It doesn’t make much sense.

I have it too on my test environment. 2022.2.19
Recycle app pool helps I believe.
I typically see it when the server is restarted, and my test server is very slow.

Could be this too in IIS

image

EDIT:
Doubled my value to 180 and fixed my issue.

3 Likes

I’ve restarted the app pool several times. 2022.2 works fine with the same app pools. But 2023.1 won’t start. I hadn’t tried changing the startup limit as we’ve not needed to do that before. I tried 180 and 300 and same result.

SQL shows successful logins from the service account that runs Epicor. No errors when the client is trying to start up. It’s really weird.

We really didnt do anything fancy. We installed 2022 and 2023 on the same Machine. Just made sure that any Windows Features that 2023 requires are installed and that .NET Core Framework 6 and other packages it requires are installed.

I’ve seen your issue when a Box was slow starting up, but not beyond that. Look into Windows Event Viewer see if there is more info.

Check the Bindings make sure its not trying to use port 443 thats in use on the same IP.

3 Likes

Thinking you might be onto something there. @hkeric.wci

@chaddb Have you tried stopping your 2022 instances and starting your 2023?

1 Like

Use ODBC to connect to the sql server from the appserver box does it work?
If it doesn’t it may be a firewall/ network issue

1 Like

I can make an ODBC connection from the app server to the SQL Server. Works fine. And 2022.2 on the same app server connects. But 2023.1 won’t connect. I uninstalled 2022.2 and only had 2023.1 installed. Same result. Reinstalled 2022.2 and it still connects.

I took 2022.2 off the app server and tried just 2023.1. Same result. 2023.1 wouldn’t start. I reinstalled 2022.2 and it started up right away.

When watching the SQL Server logs I can see the app server and service account connect to SQL right away. But then get the app failed to start message on the app server. I enabled some more logging and can see an error in the event log about the SQL connection timeout. But, ODBC and the EAC connect to the dB. Not sure how the client is connecting differently.

Application: w3wp.exe
CoreCLR Version: 6.0.1923.31806
.NET Version: 6.0.19
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeInitializationException: The type initializer for 'Ice.Hosting.AspNetCore.StartupHelper' threw an exception.
 ---> System.TypeInitializationException: The type initializer for 'Ice.Configuration.AppSettings' threw an exception.
 ---> System.Data.SqlClient.SqlException (0x80131904): Connection Timeout Expired.  The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement.  This could be because the pre-login handshake failed or the server was unable to respond back in time.  The duration spent while attempting to connect to this server was - [Pre-Login] initialization=21055; handshake=29; 
 ---> System.ComponentModel.Win32Exception (258): The wait operation timed out.

Have you double checked that your connection string is correct? Are you using Windows Auth or SQL auth? If you go into admin console server config can you test the db cnnection there successfully?

Look in your host.config file what do these connectionStrings look like?

1 Like

When you say EAC connects, was that through the Database tool, or through the database tab in the App server configuration?

Another thought… Check your application pool settings… I recall someone having an issue with the application pool with Enable 32 Bit applications was set to true causing a similar issue.

You can modify your web.config look for <aspNetCore then modify it to something like this:

    <aspNetCore processPath="dotnet" arguments=".\Bin\Epicor.Ice.Hosting.ApiHost.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">
		  <handlerSettings>
		<handlerSetting name="debugFile" value=".\logs\aspnetcore-debug.log" />
		<handlerSetting name="debugLevel" value="FILE,TRACE,DEBUG" />
	  </handlerSettings>
	    <environmentVariables>
			<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
		</environmentVariables>
	</aspNetCore>

Then you will get a logs folder in your Server directory with startup details, might have enough information on why it isnt starting.

3 Likes