The RenderBody method has already been called

It’s used in the project ASP.NET MVC, deployed in the server’s IIS. When deploying the new version, the following exception was thrown.

Solution: 1. If you can log in to the server, restart the corresponding website in IIS. 2. If you can’t log in to the server and deploy through FTP, you need to delete the previous file first, and then upload a new file instead of directly uploading a new file to cover the original file.

The problems are analyzed as follows:

This website is deployed in the IIS site on the server. Developers have no permission to log in to this server, and can only deploy remotely through FTP. In the normal operation of the website, we uploaded the_ Layout.cshtml File to replace the original file, immediately threw an exception. The analysis may be due to the conflict between IIS and application worker process after loading the new cshtml file and the previous version of its cache. The solution is to delete the old one completely first_ Layout.cshtml At this time, an exception will be thrown to the page, and the new file will not be found_ Layout.cshtml File, and then re access, everything is normal.


Read More: