0

In IIS, I have an ASP.net web application that makes many behind-the-scenes calls to an IIS-hosted WCF service.

I never had any issues during development. However, since deploying to a few test servers at work, our tester was reporting that some of the calls were seemingly randomly failing. I verified that indeed, some of those behind the scenes webapp->service calls were failing with a "(417) Expectation Failed". Hitting the back-button and attempting the action again always worked.

A common solution I kept seeing online was https://stackoverflow.com/a/7358457/1669011

After adding that to my web config, the error continued to happen, but instead of returning a 417, would end up returning the results of my web.config's applicationInitialization remapManagedRequestsTo page.

I feel like the web.config fix I mentioned above has just allowed my web application to accept the full body of the response rather than failing when it realised it wasn't the wcf response it was expecting.

So if random services in WCF are returning the results of remapped requests that occur during Application Initialization, does that indicate that my WCF services in IIS are constantly totally shutting down?

What might cause my WCF service to randomly be in a state of "application initialization"? I'm hoping this is just a server issue and nothing to do with my application, as this has come out of nowhere and is risking an upcoming deploy.

Thanks for any assistance

Community
  • 1
  • 1
Tor
  • 784
  • 1
  • 13
  • 25

1 Answers1

1

My guess would be time (or very serious exceptions).

Specifically, if the server hosting the WCF service is not being hit often enough, it will shut down the application. Follow the instructions here to ensure the WCF site is not being unloaded: How to keep a WCF site online?.

If it's exceptions, you have not provided enough information to diagnose the issue.

Community
  • 1
  • 1
Chris Shain
  • 50,833
  • 6
  • 93
  • 125
  • Thanks - no exceptions that I'm aware of (non logged or thrown). Is there a way to check that IIS has been purposefully shutting down the services? I wouldn't think it was a natural timeout, as simply spacing out operations by 5-10 minutes significantly raises the chances of this happening. Over the past 2 hours of searching around online, I hit the service 4 times - and each time, it was in the process of "starting up" and then worked a second later. – Tor Aug 26 '16 at 00:20
  • A quick google search turned up this- old, but probably still valid: http://weblogs.asp.net/scottgu/433194 – Chris Shain Aug 26 '16 at 00:25
  • This seemed to have been the general issue. I had assumed I introduced a problem to the services because these are existing services - but the WCF services were new to the solution, and I'm told by our infrastructure side that new WCF services often have this issue on older App Pools that are shutting down or timing out often. In applicationHosts.config, we've added autostart="true" and startmode="AlwaysRunning" to the App Pool, and idleTimeout="00:00:00" to its child processModel. We've also added preloadEnabled="true" to the application, and this seems to have resolved it for the time being – Tor Aug 26 '16 at 16:35