Last post May 18, 2020 07:44 PM by mgebhard
May 16, 2020 12:02 AM|Norkle|LINK
I have a .Net Core 2.+ app, it publishes to my shared hosting fine thru web publish, and it worked (registering a user, data entering the SQl database) fine the first few times after i was able to publish it to remote server. Now when trying to register
a new user, when hitting "Register" button, it renders the "
Swapping to the Development environment displays detailed information about the error that occurred....
error. According to possible fix on https://www.tutorialsteacher.com/core/aspnet-core-environment-variable , I have gone into VS , right clicked on the project name, > Debug,
and changed the ASPNETCORE_ENVIRONMENT to Production (I also did likewise on the launchsettings.json ), still the same error.
May 16, 2020 06:42 AM|Rena Ni|LINK
I have gone into VS , right clicked on the project name, > Debug, and changed the ASPNETCORE_ENVIRONMENT to Production (I also did likewise on the launchsettings.json ), still the same error.
Could you share the stack trace?It seems you could also do not run the project successfully on local kestrel.Your project may contain mistakes.Please check your code.
May 16, 2020 03:58 PM|bruce (sqlwork.com)|LINK
The error is saying if you enable developer mode, a more detailed error page will display (if you keep that code), not that setting the mode will fix the error.
May 16, 2020 09:07 PM|Norkle|LINK
The problem is, the error occurs when I run it LIVE (after web publish) on the remote server. I do not get this error when running on localhost. So this is where the confusion lies
May 16, 2020 09:28 PM|bruce (sqlwork.com)|LINK
It appears you did not write proper error logging, so you could understand errors generated in production. Ione issue is that you can only get full stack trace from a debug build. Just deploy a debug build, and if you don’t know how to set dev mode, just
take the if statement out and force the developer debug page.
but you should really add error logging.
May 17, 2020 06:54 AMfirstname.lastname@example.org|LINK
Go to IIS Manager > Select your published web app. > Configuration editor > Edit environmentVariables > set these values:
This will solve your problem.
May 18, 2020 07:25 PM|Norkle|LINK
Thanks .. I don't have this type of IIS access to my sites on the shared hosting (smarterasp.net )
May 18, 2020 07:44 PM|mgebhard|LINK
The concept is very simple. Run the application in development mode so you can see the error.
You can force developer mode in the startup.cs file as recommended above. This requires a deployment but that should not be an issue. since the application is not working
// // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
You can set development mode in the web.config.
Environment Reference docs