IIS fails to restart with a timeout error










0















When we're releasing new code to production, we often need to update .cs files in the App_Code directory. Frequently, if there are any users in production (and there are always some, even overnight), we'll get an error message on any application page load:




The assembly 'C:WindowsMicrosoft.NETFramework64v2.0.50727Temporary ASP.NET

Filesroota18f28cea6daf424App_Code.dll' is already loaded in another appdomain.




The only way we've found to get the application to respond again is by restarting IIS. Trouble is, now, that IIS will frequently fail to come back up. We restart IIS by going into the IIS manager, clicking on the server name, and then clicking Restart on the right. The system will think for several seconds, and then give the error:




Timeout error. W3SVC failed to start.




The only solution at that point is to restart the server, which we want to avoid on a production server.



Any ideas on how to troubleshoot the IIS timeout error, or (ideally) how to avoid the "already loaded in another appdomain" error in the first place?










share|improve this question


























    0















    When we're releasing new code to production, we often need to update .cs files in the App_Code directory. Frequently, if there are any users in production (and there are always some, even overnight), we'll get an error message on any application page load:




    The assembly 'C:WindowsMicrosoft.NETFramework64v2.0.50727Temporary ASP.NET

    Filesroota18f28cea6daf424App_Code.dll' is already loaded in another appdomain.




    The only way we've found to get the application to respond again is by restarting IIS. Trouble is, now, that IIS will frequently fail to come back up. We restart IIS by going into the IIS manager, clicking on the server name, and then clicking Restart on the right. The system will think for several seconds, and then give the error:




    Timeout error. W3SVC failed to start.




    The only solution at that point is to restart the server, which we want to avoid on a production server.



    Any ideas on how to troubleshoot the IIS timeout error, or (ideally) how to avoid the "already loaded in another appdomain" error in the first place?










    share|improve this question
























      0












      0








      0








      When we're releasing new code to production, we often need to update .cs files in the App_Code directory. Frequently, if there are any users in production (and there are always some, even overnight), we'll get an error message on any application page load:




      The assembly 'C:WindowsMicrosoft.NETFramework64v2.0.50727Temporary ASP.NET

      Filesroota18f28cea6daf424App_Code.dll' is already loaded in another appdomain.




      The only way we've found to get the application to respond again is by restarting IIS. Trouble is, now, that IIS will frequently fail to come back up. We restart IIS by going into the IIS manager, clicking on the server name, and then clicking Restart on the right. The system will think for several seconds, and then give the error:




      Timeout error. W3SVC failed to start.




      The only solution at that point is to restart the server, which we want to avoid on a production server.



      Any ideas on how to troubleshoot the IIS timeout error, or (ideally) how to avoid the "already loaded in another appdomain" error in the first place?










      share|improve this question














      When we're releasing new code to production, we often need to update .cs files in the App_Code directory. Frequently, if there are any users in production (and there are always some, even overnight), we'll get an error message on any application page load:




      The assembly 'C:WindowsMicrosoft.NETFramework64v2.0.50727Temporary ASP.NET

      Filesroota18f28cea6daf424App_Code.dll' is already loaded in another appdomain.




      The only way we've found to get the application to respond again is by restarting IIS. Trouble is, now, that IIS will frequently fail to come back up. We restart IIS by going into the IIS manager, clicking on the server name, and then clicking Restart on the right. The system will think for several seconds, and then give the error:




      Timeout error. W3SVC failed to start.




      The only solution at that point is to restart the server, which we want to avoid on a production server.



      Any ideas on how to troubleshoot the IIS timeout error, or (ideally) how to avoid the "already loaded in another appdomain" error in the first place?







      c# asp.net iis timeout






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 15:14









      Tim WestoverTim Westover

      778




      778






















          3 Answers
          3






          active

          oldest

          votes


















          1














          An easier/automatic solution to the above is to use an ~/App_Offline.htm file as part of your deployment process (a feature baked into IIS so WebDeploy can avoid file locking issues).



          Modify your deployment process so the first step is to create App_Offline.htm in the webroot. IIS will detect this file and promptly bring down the app domain - releasing any locks etc. Deploy your application as normal without any locking issues, and when your finished, delete the App_Offline. The next request IIS receives will start the app domain loading your newly deployed version.



          Whatever content you place inside the App_Offline.htm file is returned by IIS for all requests until you remove the file.






          share|improve this answer























          • That is an awesome idea. I didn't know there was such a feature. Thank you!

            – Tim Westover
            Nov 14 '18 at 23:07


















          0















          Go to Task Manager --> Processes and manually stop the W3SVC process.
          After doing this the process should start normally when restarting IIS




          Note: It could also be the Svchost process




          Go To Process to find the right svchost to terminate







          share|improve this answer






























            0














            Try restarting IIS from the command prompt (administrator) using:




            iisreset




            or




            iisreset /stop



            and then



            iisreset /start




            Note: May need to restart the worker process






            share|improve this answer
























              Your Answer






              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "1"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53303344%2fiis-fails-to-restart-with-a-timeout-error%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              An easier/automatic solution to the above is to use an ~/App_Offline.htm file as part of your deployment process (a feature baked into IIS so WebDeploy can avoid file locking issues).



              Modify your deployment process so the first step is to create App_Offline.htm in the webroot. IIS will detect this file and promptly bring down the app domain - releasing any locks etc. Deploy your application as normal without any locking issues, and when your finished, delete the App_Offline. The next request IIS receives will start the app domain loading your newly deployed version.



              Whatever content you place inside the App_Offline.htm file is returned by IIS for all requests until you remove the file.






              share|improve this answer























              • That is an awesome idea. I didn't know there was such a feature. Thank you!

                – Tim Westover
                Nov 14 '18 at 23:07















              1














              An easier/automatic solution to the above is to use an ~/App_Offline.htm file as part of your deployment process (a feature baked into IIS so WebDeploy can avoid file locking issues).



              Modify your deployment process so the first step is to create App_Offline.htm in the webroot. IIS will detect this file and promptly bring down the app domain - releasing any locks etc. Deploy your application as normal without any locking issues, and when your finished, delete the App_Offline. The next request IIS receives will start the app domain loading your newly deployed version.



              Whatever content you place inside the App_Offline.htm file is returned by IIS for all requests until you remove the file.






              share|improve this answer























              • That is an awesome idea. I didn't know there was such a feature. Thank you!

                – Tim Westover
                Nov 14 '18 at 23:07













              1












              1








              1







              An easier/automatic solution to the above is to use an ~/App_Offline.htm file as part of your deployment process (a feature baked into IIS so WebDeploy can avoid file locking issues).



              Modify your deployment process so the first step is to create App_Offline.htm in the webroot. IIS will detect this file and promptly bring down the app domain - releasing any locks etc. Deploy your application as normal without any locking issues, and when your finished, delete the App_Offline. The next request IIS receives will start the app domain loading your newly deployed version.



              Whatever content you place inside the App_Offline.htm file is returned by IIS for all requests until you remove the file.






              share|improve this answer













              An easier/automatic solution to the above is to use an ~/App_Offline.htm file as part of your deployment process (a feature baked into IIS so WebDeploy can avoid file locking issues).



              Modify your deployment process so the first step is to create App_Offline.htm in the webroot. IIS will detect this file and promptly bring down the app domain - releasing any locks etc. Deploy your application as normal without any locking issues, and when your finished, delete the App_Offline. The next request IIS receives will start the app domain loading your newly deployed version.



              Whatever content you place inside the App_Offline.htm file is returned by IIS for all requests until you remove the file.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Nov 14 '18 at 21:42









              MisterSmithMisterSmith

              957611




              957611












              • That is an awesome idea. I didn't know there was such a feature. Thank you!

                – Tim Westover
                Nov 14 '18 at 23:07

















              • That is an awesome idea. I didn't know there was such a feature. Thank you!

                – Tim Westover
                Nov 14 '18 at 23:07
















              That is an awesome idea. I didn't know there was such a feature. Thank you!

              – Tim Westover
              Nov 14 '18 at 23:07





              That is an awesome idea. I didn't know there was such a feature. Thank you!

              – Tim Westover
              Nov 14 '18 at 23:07













              0















              Go to Task Manager --> Processes and manually stop the W3SVC process.
              After doing this the process should start normally when restarting IIS




              Note: It could also be the Svchost process




              Go To Process to find the right svchost to terminate







              share|improve this answer



























                0















                Go to Task Manager --> Processes and manually stop the W3SVC process.
                After doing this the process should start normally when restarting IIS




                Note: It could also be the Svchost process




                Go To Process to find the right svchost to terminate







                share|improve this answer

























                  0












                  0








                  0








                  Go to Task Manager --> Processes and manually stop the W3SVC process.
                  After doing this the process should start normally when restarting IIS




                  Note: It could also be the Svchost process




                  Go To Process to find the right svchost to terminate







                  share|improve this answer














                  Go to Task Manager --> Processes and manually stop the W3SVC process.
                  After doing this the process should start normally when restarting IIS




                  Note: It could also be the Svchost process




                  Go To Process to find the right svchost to terminate








                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 14 '18 at 15:20









                  Wojtek TWojtek T

                  1,435422




                  1,435422





















                      0














                      Try restarting IIS from the command prompt (administrator) using:




                      iisreset




                      or




                      iisreset /stop



                      and then



                      iisreset /start




                      Note: May need to restart the worker process






                      share|improve this answer





























                        0














                        Try restarting IIS from the command prompt (administrator) using:




                        iisreset




                        or




                        iisreset /stop



                        and then



                        iisreset /start




                        Note: May need to restart the worker process






                        share|improve this answer



























                          0












                          0








                          0







                          Try restarting IIS from the command prompt (administrator) using:




                          iisreset




                          or




                          iisreset /stop



                          and then



                          iisreset /start




                          Note: May need to restart the worker process






                          share|improve this answer















                          Try restarting IIS from the command prompt (administrator) using:




                          iisreset




                          or




                          iisreset /stop



                          and then



                          iisreset /start




                          Note: May need to restart the worker process







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Nov 14 '18 at 15:23

























                          answered Nov 14 '18 at 15:17









                          BoywithanafroBoywithanafro

                          49111




                          49111



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53303344%2fiis-fails-to-restart-with-a-timeout-error%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              這個網誌中的熱門文章

                              How to read a connectionString WITH PROVIDER in .NET Core?

                              Node.js Script on GitHub Pages or Amazon S3

                              Museum of Modern and Contemporary Art of Trento and Rovereto