Beispiel #1
0
        void EnsureInitialized()
        {
            if (!initialized)
            {
                lock (ThisLock)
                {
                    if (!initialized)
                    {
                        // Register protocols.
                        foreach (string protocol in metabaseSettings.GetProtocols())
                        {
                            // special case HTTP, it's a legacy protocol
                            if (string.CompareOrdinal(protocol, Uri.UriSchemeHttp) == 0 ||
                                string.CompareOrdinal(protocol, Uri.UriSchemeHttps) == 0)
                            {
                                HttpHostedTransportConfiguration httpConfiguration = null;
                                if (string.CompareOrdinal(protocol, Uri.UriSchemeHttp) == 0)
                                {
                                    httpConfiguration = new HttpHostedTransportConfiguration();
                                }
                                else
                                {
                                    httpConfiguration = new HttpsHostedTransportConfiguration();
                                }

                                configurations.Add(protocol, httpConfiguration);
                            }
                            else
                            {
                                if (!Iis7Helper.IsIis7)
                                {
                                    throw Fx.AssertAndThrowFatal("HostedTransportConfigurationManager.EnsureInitialized() protocols other than http and https can only be configured in IIS7");
                                }
                                if (AspNetPartialTrustHelpers.NeedPartialTrustInvoke)
                                {
                                    throw FxTrace.Exception.AsError(new InvalidOperationException(SR.PartialTrustNonHttpActivation(protocol, HostingEnvironmentWrapper.ApplicationVirtualPath)));
                                }
                                AddHostedTransportConfigurationIis7(protocol);
                            }
                        }

                        initialized = true;
                    }
                }
            }
        }
Beispiel #2
0
 private void EnsureInitialized()
 {
     if (!this.initialized)
     {
         lock (this.ThisLock)
         {
             if (!this.initialized)
             {
                 foreach (string str in this.metabaseSettings.GetProtocols())
                 {
                     if ((string.CompareOrdinal(str, Uri.UriSchemeHttp) == 0) || (string.CompareOrdinal(str, Uri.UriSchemeHttps) == 0))
                     {
                         HttpHostedTransportConfiguration configuration = null;
                         if (string.CompareOrdinal(str, Uri.UriSchemeHttp) == 0)
                         {
                             configuration = new HttpHostedTransportConfiguration();
                         }
                         else
                         {
                             configuration = new HttpsHostedTransportConfiguration();
                         }
                         this.configurations.Add(str, configuration);
                     }
                     else
                     {
                         if (!Iis7Helper.IsIis7)
                         {
                             throw Fx.AssertAndThrowFatal("HostedTransportConfigurationManager.EnsureInitialized() protocols other than http and https can only be configured in IIS7");
                         }
                         if (AspNetPartialTrustHelpers.NeedPartialTrustInvoke)
                         {
                             throw FxTrace.Exception.AsError(new InvalidOperationException(System.ServiceModel.Activation.SR.PartialTrustNonHttpActivation(str, HostingEnvironmentWrapper.ApplicationVirtualPath)));
                         }
                         this.AddHostedTransportConfigurationIis7(str);
                     }
                 }
                 this.initialized = true;
             }
         }
     }
 }
        void EnsureInitialized()
        {
            if (!initialized)
            {
                lock (ThisLock)
                {
                    if (!initialized)
                    {
                        // Register protocols.
                        foreach (string protocol in metabaseSettings.GetProtocols())
                        {
                            // special case HTTP, it's a legacy protocol
                            if (string.CompareOrdinal(protocol, Uri.UriSchemeHttp) == 0 ||
                                string.CompareOrdinal(protocol, Uri.UriSchemeHttps) == 0)
                            {
                                HttpHostedTransportConfiguration httpConfiguration = null;
                                if (string.CompareOrdinal(protocol, Uri.UriSchemeHttp) == 0)
                                {
                                    httpConfiguration = new HttpHostedTransportConfiguration();
                                }
                                else
                                {
                                    httpConfiguration = new HttpsHostedTransportConfiguration();
                                }

                                configurations.Add(protocol, httpConfiguration);
                            }
                            else
                            {
                                if (!Iis7Helper.IsIis7)
                                {
                                    throw Fx.AssertAndThrowFatal("HostedTransportConfigurationManager.EnsureInitialized() protocols other than http and https can only be configured in IIS7");
                                }
                                if (AspNetPartialTrustHelpers.NeedPartialTrustInvoke)
                                {
                                    throw FxTrace.Exception.AsError(new InvalidOperationException(SR.PartialTrustNonHttpActivation(protocol, HostingEnvironmentWrapper.ApplicationVirtualPath)));
                                }
                                AddHostedTransportConfigurationIis7(protocol);
                            }
                        }

                        initialized = true;
                    }
                }
            }
        }
 private void EnsureInitialized()
 {
     if (!this.initialized)
     {
         lock (this.ThisLock)
         {
             if (!this.initialized)
             {
                 foreach (string str in this.metabaseSettings.GetProtocols())
                 {
                     if ((string.CompareOrdinal(str, Uri.UriSchemeHttp) == 0) || (string.CompareOrdinal(str, Uri.UriSchemeHttps) == 0))
                     {
                         HttpHostedTransportConfiguration configuration = null;
                         if (string.CompareOrdinal(str, Uri.UriSchemeHttp) == 0)
                         {
                             configuration = new HttpHostedTransportConfiguration();
                         }
                         else
                         {
                             configuration = new HttpsHostedTransportConfiguration();
                         }
                         this.configurations.Add(str, configuration);
                     }
                     else
                     {
                         if (!Iis7Helper.IsIis7)
                         {
                             throw Fx.AssertAndThrowFatal("HostedTransportConfigurationManager.EnsureInitialized() protocols other than http and https can only be configured in IIS7");
                         }
                         if (AspNetPartialTrustHelpers.NeedPartialTrustInvoke)
                         {
                             throw FxTrace.Exception.AsError(new InvalidOperationException(System.ServiceModel.Activation.SR.PartialTrustNonHttpActivation(str, HostingEnvironmentWrapper.ApplicationVirtualPath)));
                         }
                         this.AddHostedTransportConfigurationIis7(str);
                     }
                 }
                 this.initialized = true;
             }
         }
     }
 }