I'm having issue deploying ASP.NET MVC app with precompiled views. Until now I was not precompiling views and app has worked for years flawlessly. If I precompile them, the site works on first start just as you'd expect. If I however restart it from IIS, I start getting 404.0 errors. The funny part is: if I change app's non-essential configuration in IIS, IIS restarts app by itself and it comes to life. If it gets recycled or restarted, then it goes back to 404.0s.
I noticed error page describes incorrect physical path. In the screenshot below the physical path is C:\wwwsites\workpal\settings. In fact 'settings' is controller name and is a folder at path: C:\wwwsites\workpal\views\settings which contains index.cshtml. Also, should StaticFile be used here? I'm a newb, but to me it looks like IIS doesn't have a clue how to resolve URLs.
- Application is running .NET 4.7.2
- IIS 8.5
- Application has worked for years without precompiled views, no issues. We used .NET 4.5 earlier, but I doubt it's the reason. I get same results with 4.5.
- The only change is turning on precompiled views in VS publish settings. I have tried every 'Advanced Precompile Settings' configuration - same results.
- Application with precompiled views works on first start, when IIS detects change in app's directory or when I change non-essential app setting in IIS.
- Application doesn't work when recycled or when restarted manually.
- I've tried fresh AppPool and fresh Site - to no avail.
- Tested on two unrelated servers (physical machines).