1

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?

Community
  • 1
  • 1
roverred
  • 1,841
  • 5
  • 29
  • 46

1 Answers1

1

So the problem was that I was sending one PUT request too quickly after another. I added a small delay of 250ms between them and this error is no longer an issue.

Edit: The need for the delay got too annoying, so I looked into it more. The reason for my problems was because I was writing to the bin folder of the web app.

Does any change in any file inside bin folder cause application recycle in ASP.NET web application?

Community
  • 1
  • 1
roverred
  • 1,841
  • 5
  • 29
  • 46