So when I"m doing an ajax request to PUT
onto the server I periodically get the exception thrown:
System.ServiceModel.ServiceActivationException
Whenever I refresh the page and do the PUT
request for the first time, I always gets this error. If I send the same request again immediately with the same content, it works. Future requests sometimes get this error again. When the page first loads many GET
requests are performed and they never face this problem.
The Ajax call is:
$.ajax({
url: uri,
type: "PUT",
data: contents,
processData: false,
dataType: "json",
success: settings.success,
error: settings.error
});
The C# function called is
[OperationContract]
[WebInvoke(UriTemplate = "users/{userName}/projects/{projectName}/{*fileName}", Method = "PUT", ResponseFormat = WebMessageFormat.Json)]
string PutFile(string userName, string projectName, string fileName, Stream fileContents);
From the event viewer logs here is the error detailed:
WebHost failed to process a request.
Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/45004378
Exception: System.ServiceModel.ServiceActivationException: Request to the service at '~/' cannot be dispatched because the virtual application at '/bb' is shutting down.
---> System.InvalidOperationException: Request to the service at '~/' cannot be dispatched because the virtual application at '/bb' is shutting down.
I've tried to disable application recycle by following this link: https://serverfault.com/questions/333907/what-should-i-do-to-make-sure-that-iis-does-not-recycle-my-application
But it didn't help at all. What could be some possible reasons that my application is shutting down when I make the requests?