internal static void SetSubscriptionServerInformation(ServerInformation serverInformation)
 {
     Logger currentThreadLogger = GetCurrentThreadLogger();
     if (currentThreadLogger != null)
     {
         lock (currentThreadLogger)
         {
             currentThreadLogger.Sources.SubscriptionServerInformation = serverInformation;
         }
     }
 }
 private static void AppendServerInformation(StringBuilder destination, ServerInformation serverInformation)
 {
     if (!string.IsNullOrEmpty(serverInformation.Server))
     {
         destination.AppendFormat(CultureInfo.CurrentUICulture, Resources.GetString("LogFile_ServerInformationServer"), new object[] { serverInformation.Server });
     }
     if (!string.IsNullOrEmpty(serverInformation.PoweredBy))
     {
         destination.AppendFormat(CultureInfo.CurrentUICulture, Resources.GetString("LogFile_ServerInformationPoweredBy"), new object[] { serverInformation.PoweredBy });
     }
     if (!string.IsNullOrEmpty(serverInformation.AspNetVersion))
     {
         destination.AppendFormat(CultureInfo.CurrentUICulture, Resources.GetString("LogFile_ServerInformationAspNetVersion"), new object[] { serverInformation.AspNetVersion });
     }
 }
 internal static void SetDeploymentProviderServerInformation(ServerInformation serverInformation)
 {
     Logger currentThreadLogger = GetCurrentThreadLogger();
     if (currentThreadLogger != null)
     {
         lock (currentThreadLogger)
         {
             currentThreadLogger.Sources.DeploymentProviderServerInformation = serverInformation;
         }
     }
 }
 private static AssemblyManifest DownloadManifest(ref Uri sourceUri, string targetPath, IDownloadNotification notification, DownloadOptions options, AssemblyManifest.ManifestType manifestType, out ServerInformation serverInformation)
 {
     Logger.AddMethodCall("DownloadManifest called.");
     DownloadManifestAsRawFile(ref sourceUri, targetPath, notification, options, out serverInformation);
     return ManifestReader.FromDocument(targetPath, manifestType, sourceUri);
 }
 private static void DownloadManifestAsRawFile(ref Uri sourceUri, string targetPath, IDownloadNotification notification, DownloadOptions options, out ServerInformation serverInformation)
 {
     Logger.AddMethodCall("DownloadManifestAsRawFile called.");
     FileDownloader downloader = FileDownloader.Create();
     downloader.Options = options;
     if (notification != null)
     {
         downloader.AddNotification(notification);
     }
     try
     {
         downloader.AddFile(sourceUri, targetPath, 0x1000000);
         downloader.Download(null);
         sourceUri = downloader.DownloadResults[0].ResponseUri;
         serverInformation = downloader.DownloadResults[0].ServerInformation;
     }
     finally
     {
         if (notification != null)
         {
             downloader.RemoveNotification(notification);
         }
     }
 }
 private static AssemblyManifest DownloadDeploymentManifestDirect(SubscriptionStore subStore, ref Uri sourceUri, out TempFile tempFile, IDownloadNotification notification, DownloadOptions options, out ServerInformation serverInformation)
 {
     Logger.AddMethodCall("DownloadDeploymentManifestDirect(" + sourceUri + ") called.");
     tempFile = subStore.AcquireTempFile(".application");
     AssemblyManifest manifest = DownloadManifest(ref sourceUri, tempFile.Path, notification, options, AssemblyManifest.ManifestType.Deployment, out serverInformation);
     if (manifest.Identity.Version == null)
     {
         throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_DeploymentManifestNoVersion"));
     }
     if (manifest.Deployment == null)
     {
         throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_InvalidDeploymentManifest"));
     }
     return manifest;
 }
 private static AssemblyManifest DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, ref Uri sourceUri, out TempFile tempFile, out SubscriptionState subState, IDownloadNotification notification, DownloadOptions options, out ServerInformation serverInformation)
 {
     Logger.AddMethodCall("DownloadDeploymentManifestDirectBypass called.");
     subState = null;
     tempFile = subStore.AcquireTempFile(".application");
     DownloadManifestAsRawFile(ref sourceUri, tempFile.Path, notification, options, out serverInformation);
     bool flag = false;
     AssemblyManifest deployment = null;
     DefinitionIdentity identity = null;
     DefinitionIdentity identity2 = null;
     DefinitionAppId appId = null;
     try
     {
         deployment = ManifestReader.FromDocumentNoValidation(tempFile.Path);
         identity = deployment.Identity;
         identity2 = new DefinitionIdentity(deployment.MainDependentAssembly.Identity);
         Uri uri = ((sourceUri.Query != null) && (sourceUri.Query.Length > 0)) ? new Uri(sourceUri.GetLeftPart(UriPartial.Path)) : sourceUri;
         appId = new DefinitionAppId(uri.AbsoluteUri, new DefinitionIdentity[] { identity, identity2 });
         Logger.AddInternalState("expectedAppId=" + appId.ToString());
     }
     catch (InvalidDeploymentException)
     {
         flag = true;
     }
     catch (COMException)
     {
         flag = true;
     }
     catch (SEHException)
     {
         flag = true;
     }
     catch (IndexOutOfRangeException)
     {
         flag = true;
     }
     if (!flag)
     {
         long num;
         SubscriptionState subscriptionState = subStore.GetSubscriptionState(deployment);
         bool flag2 = false;
         using (subStore.AcquireReferenceTransaction(out num))
         {
             flag2 = subStore.CheckAndReferenceApplication(subscriptionState, appId, num);
         }
         if (flag2 && appId.Equals(subscriptionState.CurrentBind))
         {
             Logger.AddInternalState("Application is found in store and it is the CurrentBind, bypass validation and further downloads.");
             subState = subscriptionState;
             return subState.CurrentDeploymentManifest;
         }
         flag = true;
         if (flag2)
         {
             Logger.AddInternalState("Application is found in store and but it is not the CurrentBind.");
         }
     }
     else
     {
         Logger.AddInternalState("Application is not found in store.");
     }
     Logger.AddInternalState("Reparse the deployment manifest for validations.");
     AssemblyManifest manifest2 = ManifestReader.FromDocument(tempFile.Path, AssemblyManifest.ManifestType.Deployment, sourceUri);
     if (manifest2.Identity.Version == null)
     {
         throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_DeploymentManifestNoVersion"));
     }
     if (manifest2.Deployment == null)
     {
         throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_InvalidDeploymentManifest"));
     }
     return manifest2;
 }
示例#8
0
        private static void DownloadManifestAsRawFile(ref Uri sourceUri, string targetPath, IDownloadNotification notification, DownloadOptions options, out ServerInformation serverInformation)
        {
            Logger.AddMethodCall("DownloadManifestAsRawFile called.");
            FileDownloader fileDownloader = FileDownloader.Create();

            fileDownloader.Options = options;
            if (notification != null)
            {
                fileDownloader.AddNotification(notification);
            }
            try
            {
                fileDownloader.AddFile(sourceUri, targetPath, 16777216);
                fileDownloader.Download((SubscriptionState)null, DownloadManager.ClientCertificate);
                sourceUri         = fileDownloader.DownloadResults[0].ResponseUri;
                serverInformation = fileDownloader.DownloadResults[0].ServerInformation;
                DownloadManager.ClientCertificate = fileDownloader.ClientCertificate;
            }
            finally
            {
                if (notification != null)
                {
                    fileDownloader.RemoveNotification(notification);
                }
            }
        }
示例#9
0
 private static AssemblyManifest DownloadManifest(ref Uri sourceUri, string targetPath, IDownloadNotification notification, DownloadOptions options, AssemblyManifest.ManifestType manifestType, out ServerInformation serverInformation)
 {
     Logger.AddMethodCall("DownloadManifest called.");
     DownloadManager.DownloadManifestAsRawFile(ref sourceUri, targetPath, notification, options, out serverInformation);
     return(ManifestReader.FromDocument(targetPath, manifestType, sourceUri));
 }
示例#10
0
        private static AssemblyManifest DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, ref Uri sourceUri, out TempFile tempFile, out SubscriptionState subState, IDownloadNotification notification, DownloadOptions options, out ServerInformation serverInformation)
        {
            Logger.AddMethodCall("DownloadDeploymentManifestDirectBypass called.");
            subState = (SubscriptionState)null;
            tempFile = subStore.AcquireTempFile(".application");
            DownloadManager.DownloadManifestAsRawFile(ref sourceUri, tempFile.Path, notification, options, out serverInformation);
            bool             flag1      = false;
            AssemblyManifest deployment = (AssemblyManifest)null;
            DefinitionAppId  appId      = (DefinitionAppId)null;

            try
            {
                deployment = ManifestReader.FromDocumentNoValidation(tempFile.Path);
                DefinitionIdentity identity           = deployment.Identity;
                DefinitionIdentity definitionIdentity = new DefinitionIdentity(deployment.MainDependentAssembly.Identity);
                appId = new DefinitionAppId((sourceUri.Query == null || sourceUri.Query.Length <= 0 ? sourceUri : new Uri(sourceUri.GetLeftPart(UriPartial.Path))).AbsoluteUri, new DefinitionIdentity[2]
                {
                    identity,
                    definitionIdentity
                });
                Logger.AddInternalState("expectedAppId=" + appId.ToString());
            }
            catch (InvalidDeploymentException ex)
            {
                flag1 = true;
            }
            catch (COMException ex)
            {
                flag1 = true;
            }
            catch (SEHException ex)
            {
                flag1 = true;
            }
            catch (IndexOutOfRangeException ex)
            {
                flag1 = true;
            }
            if (!flag1)
            {
                SubscriptionState subscriptionState = subStore.GetSubscriptionState(deployment);
                bool flag2 = false;
                long transactionId;
                using (subStore.AcquireReferenceTransaction(out transactionId))
                    flag2 = subStore.CheckAndReferenceApplication(subscriptionState, appId, transactionId);
                if (!flag2 || !appId.Equals((object)subscriptionState.CurrentBind))
                {
                    if (flag2)
                    {
                        Logger.AddInternalState("Application is found in store and but it is not the CurrentBind.");
                    }
                }
                else
                {
                    Logger.AddInternalState("Application is found in store and it is the CurrentBind, bypass validation and further downloads.");
                    subState = subscriptionState;
                    return(subState.CurrentDeploymentManifest);
                }
            }
            else
            {
                Logger.AddInternalState("Application is not found in store.");
            }
            Logger.AddInternalState("Reparse the deployment manifest for validations.");
            AssemblyManifest assemblyManifest = ManifestReader.FromDocument(tempFile.Path, AssemblyManifest.ManifestType.Deployment, sourceUri);

            if (assemblyManifest.Identity.Version == (Version)null)
            {
                throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_DeploymentManifestNoVersion"));
            }
            if (assemblyManifest.Deployment == null)
            {
                throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_InvalidDeploymentManifest"));
            }
            return(assemblyManifest);
        }
示例#11
0
        private static AssemblyManifest DownloadDeploymentManifestDirect(SubscriptionStore subStore, ref Uri sourceUri, out TempFile tempFile, IDownloadNotification notification, DownloadOptions options, out ServerInformation serverInformation)
        {
            Logger.AddMethodCall("DownloadDeploymentManifestDirect(" + (object)sourceUri + ") called.");
            tempFile = subStore.AcquireTempFile(".application");
            AssemblyManifest assemblyManifest = DownloadManager.DownloadManifest(ref sourceUri, tempFile.Path, notification, options, AssemblyManifest.ManifestType.Deployment, out serverInformation);

            if (assemblyManifest.Identity.Version == (Version)null)
            {
                throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_DeploymentManifestNoVersion"));
            }
            if (assemblyManifest.Deployment == null)
            {
                throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_InvalidDeploymentManifest"));
            }
            return(assemblyManifest);
        }
        private static void DownloadManifestAsRawFile(ref Uri sourceUri, string targetPath, IDownloadNotification notification, DownloadOptions options, out ServerInformation serverInformation)
        {
            Logger.AddMethodCall("DownloadManifestAsRawFile called.");
            FileDownloader downloader = FileDownloader.Create();

            downloader.Options = options;
            if (notification != null)
            {
                downloader.AddNotification(notification);
            }
            try
            {
                downloader.AddFile(sourceUri, targetPath, 0x1000000);
                downloader.Download(null);
                sourceUri         = downloader.DownloadResults[0].ResponseUri;
                serverInformation = downloader.DownloadResults[0].ServerInformation;
            }
            finally
            {
                if (notification != null)
                {
                    downloader.RemoveNotification(notification);
                }
            }
        }