public static void CheckAssembly() { try { var path = (string)AppDomain.CurrentDomain.GetData(_assemblyKey); var loader = new PluginsAndWorkflowLoader(); AssemblyReaderResult result = loader.LoadAssembly(path); byte[] fileBody = null; DataContractSerializer ser = new DataContractSerializer(typeof(AssemblyReaderResult)); using (var memoryStream = new MemoryStream()) { ser.WriteObject(memoryStream, result); memoryStream.Seek(0, SeekOrigin.Begin); fileBody = memoryStream.ToArray(); } AppDomain.CurrentDomain.SetData(_resultKey, fileBody); } catch (Exception ex) { DTEHelper.WriteExceptionToLog(ex); } }
private static DiscoveryServiceProxy CreateDiscoveryService(ConnectionData connectionData, Uri discoveryUrl, string username, string password) { try { var serviceManagement = GetDiscoveryServiceConfiguration(connectionData, discoveryUrl); if (serviceManagement != null) { return(CreateDiscoveryService(serviceManagement, username, password)); } } catch (Exception ex) { DTEHelper.WriteExceptionToLog(ex); } return(null); }
public static bool UrlIsAvailable(Uri uri) { try { IgnoreCertificateValidation(); var request = WebRequest.Create(uri) as HttpWebRequest; request.Timeout = 5000; request.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(AcceptAllCertifications); using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) { int statusCode = (int)response.StatusCode; if (statusCode >= 100 && statusCode < 400) { return(true); } else if (statusCode >= 500 && statusCode <= 510) { return(false); } } } catch (WebException ex) { DTEHelper.WriteExceptionToLog(ex); if (ex.Status == WebExceptionStatus.ProtocolError) { return(false); } } catch (Exception ex) { DTEHelper.WriteExceptionToLog(ex); } return(false); }
public static bool UrlIsAvailable(Uri uri) { try { var request = WebRequest.Create(uri) as HttpWebRequest; request.Timeout = 5000; using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) { int statusCode = (int)response.StatusCode; if (statusCode >= 100 && statusCode < 400) { return(true); } else if (statusCode >= 500 && statusCode <= 510) { return(false); } } } catch (WebException ex) { DTEHelper.WriteExceptionToLog(ex); if (ex.Status == WebExceptionStatus.ProtocolError) { return(false); } } catch (Exception ex) { DTEHelper.WriteExceptionToLog(ex); } return(false); }