0

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.

The error

  • 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).
Merode
  • 1
  • 1
  • did you try to reproduce the same issue with the newly created app? could you share more information about your site? what is the precompiled configuration in vs? try to set in web.config file. make sure your site app pool is running under integrated application pool. and ASP.NET 4 filter is available at your site. – Jalpa Panchal May 21 '20 at 03:23
  • Hey @JalpaPanchal - I've tried with both fresh AppPool and fresh Site/App. I've tried all possible precompiled configurations in VS to no avail - my most desired one is: DO NOT allow precompiled site to be updatable, merge all outputs to a single assembly, treat as library component. I've tried configuring modules tag as you said but to no avail - according to MS, since IIS7 this option makes no sense. AppPool is set to integrated mode - the app has been working for years (without precompilation). That part is interesting - can you elaborate on filter? Where to find it and how to set it? – Merode May 21 '20 at 07:18
  • @JalpaPanchal I'll try creating fresh new app and test it. If you meant RegisterGlobalFilters(...) by filters, this method is empty. – Merode May 21 '20 at 07:22
  • check ispi filter of your site for asp.net 4 module. – Jalpa Panchal May 21 '20 at 07:35
  • There's both 2.0 and 4.0, each with 32bit and 64bit variant - 4 items total. – Merode May 21 '20 at 08:06
  • try to run failed request tracing in iis for the 404 error. https://learn.microsoft.com/en-us/iis/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis – Jalpa Panchal May 28 '20 at 09:44

0 Answers0