public static void CloseAllConnection() { if (serviceClient != null) { serviceClient.Close(); serviceClient = null; } if (serviceHost != null) { serviceHost.Close(); serviceHost = null; } }
public static void CreateConnection() { if (Standalone) { var localUri = new Uri("http://localhost:8733/Design_Time_Addresses/SpecTracker.Core.Service/ProjectService/"); serviceHost = new ServiceHost(typeof(SpecTracker.Core.Service.ProjectService), localUri); serviceHost.Open(); serviceClient = new ProjectServiceClient(new BasicHttpBinding(), new EndpointAddress(localUri)); } else serviceClient = new ProjectServiceClient(); serviceClient.Open(); }
public void Application_Error(object sender, EventArgs e) { // Code that runs when an unhandled error occurs // Get the exception object. Exception exc = Server.GetLastError(); // Handle HTTP errors if (exc.GetType() == typeof(HttpException)) { // The Complete Error Handling Example generates // some errors using URLs with "NoCatch" in them; // ignore these here to simulate what would happen // if a global.asax handler were not implemented. //if (exc.Message.Contains("NoCatch") || exc.Message.Contains("maxUrlLength")) // return; //Redirect HTTP errors to HttpError page Server.Transfer("HttpErrorPage.aspx"); } // For other kinds of errors give the user some information // but stay on the default page Response.Write("<h2>Error</h2>\n"); if (exc.Message.Contains("timed")) { Response.Write("The operation took longer than expected so it was aborted. Please go back"); } if (exc.Message.Contains("endpoint")) { Response.Write("The service which you are trying to reach is ofline. Try restarting it or contacting your provider"); } else { Response.Write("You are either not logged in, have no restrictions for viewing the page, or the page does not exist"); } IProjectService AccService = new ProjectServiceClient("secure"); AccService.LogError(exc); // Clear the error from the server Server.ClearError(); }
public static void CreateConnection() { if (Standalone) { var localUri = new Uri("http://localhost:8733/Design_Time_Addresses/SpecTracker.Core.Service/ProjectService/"); serviceHost = new ServiceHost(typeof(SpecTracker.Core.Service.ProjectService), localUri); serviceHost.Open(); serviceClient = new ProjectServiceClient(new BasicHttpBinding(), new EndpointAddress(localUri)); } else { serviceClient = new ProjectServiceClient(); } serviceClient.Open(); }
public WcfProjectService(ProjectServiceClient service) { _service = service; }