// Our client is scoped to the lifetime of the HttpApplication so // when the Application_End method is invoked, we should call Close on the client public void Application_End(object sender, EventArgs e) { WeatherServiceClient localClient = client; if (localClient != null && localClient.State == System.ServiceModel.CommunicationState.Opened) { localClient.Close(); } }