• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Web.Administration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.Web.Administration的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Web.Administration类的具体用法?C# Microsoft.Web.Administration怎么用?C# Microsoft.Web.Administration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Microsoft.Web.Administration类属于命名空间,在下文中一共展示了Microsoft.Web.Administration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetSiteUrl

        private static string GetSiteUrl(IIS.Site site)
        {
            var urls = GetSiteUrls(site);

            if (urls == null)
            {
                return null;
            }
            else
            {
                return urls.FirstOrDefault();
            }
        }
开发者ID:richardprice,项目名称:kudu,代码行数:13,代码来源:SiteManager.cs


示例2: InvalidOperationException

        private static async Task WaitForState(Func<IIS.ObjectState> getState, IIS.ObjectState state)
        {
            TimeSpan totalWait = TimeSpan.Zero;

            IIS.ObjectState? currentState;
            while ((currentState = SafeGetState(getState)) != state)
            {
                totalWait += _waitInterval;
                if (totalWait > _maxWaitInterval)
                {
                    throw new InvalidOperationException(String.Format("State unchanged after {0} seconds. Expected state: '{1}', actual state: '{2}'.",
                        totalWait.TotalSeconds, state, currentState));
                }
                await Task.Delay(_waitInterval);
            }
        }
开发者ID:robzelt,项目名称:kudu,代码行数:16,代码来源:IISExtensions.cs


示例3: Site

        internal Site(IIS.Site iisSite, bool isCurrentSite)
        {
            Name = iisSite.Name;
            Urls = iisSite.Bindings
                          .Select(b => new UriBuilder
                          {
                               Host = string.IsNullOrEmpty(b.Host) ? "localhost" : b.Host,
                               Scheme = b.Protocol,
                               Port = b.EndPoint.Port == 80 ? -1 : b.EndPoint.Port
                          }.Uri);

            if (new[] { IIS.ObjectState.Started, IIS.ObjectState.Starting }.Any(os => os == iisSite.State))
                State = SiteState.Started;

            IsCurrentSite = isCurrentSite;
        }
开发者ID:n3rd,项目名称:Hyperion,代码行数:16,代码来源:Site.cs


示例4: GetSiteUrl

        private string GetSiteUrl(IIS.Site site)
        {
            if (site == null)
            {
                return null;
            }

            IIS.Binding binding = site.Bindings.Last();
            var builder = new UriBuilder
            {
                Host = String.IsNullOrEmpty(binding.Host) ? "localhost" : binding.Host,
                Scheme = binding.Protocol,
                Port = binding.EndPoint.Port
            };

            if (builder.Port == 80)
            {
                builder.Port = -1;
            }

            return builder.ToString();
        }
开发者ID:kohenkatz,项目名称:kudu,代码行数:22,代码来源:SiteManager.cs


示例5: GetSiteUrls

        private static List<string> GetSiteUrls(IIS.Site site)
        {
            var urls = new List<string>();

            if (site == null)
            {
                return null;
            }

            foreach (IIS.Binding binding in site.Bindings)
            {
                var builder = new UriBuilder
                {
                    Host = String.IsNullOrEmpty(binding.Host) ? "localhost" : binding.Host,
                    Scheme = binding.Protocol,
                    Port = binding.EndPoint.Port == 80 ? -1 : binding.EndPoint.Port
                };

                urls.Add(builder.ToString());
            }

            return urls;
        }
开发者ID:albertjan,项目名称:kudu,代码行数:23,代码来源:SiteManager.cs


示例6: EnsureDefaultDocument

        private static void EnsureDefaultDocument(IIS.ServerManager iis)
        {
            Configuration applicationHostConfiguration = iis.GetApplicationHostConfiguration();
            ConfigurationSection defaultDocumentSection = applicationHostConfiguration.GetSection("system.webServer/defaultDocument");

            ConfigurationElementCollection filesCollection = defaultDocumentSection.GetCollection("files");

            if (!filesCollection.Any(ConfigurationElementContainsHostingStart))
            {
                ConfigurationElement addElement = filesCollection.CreateElement("add");

                addElement["value"] = HostingStartHtml;
                filesCollection.Add(addElement);

                iis.CommitChanges();
            }
        }
开发者ID:bogdansa,项目名称:kudu,代码行数:17,代码来源:SiteManager.cs


示例7: CreateSite

        private IIS.Site CreateSite(IIS.ServerManager iis, string applicationName, string siteName, string siteRoot, List<string> siteBindings)
        {
            var pool = EnsureAppPool(iis, applicationName);

            EnsureDefaultDocument(iis);

            IIS.Site site;

            if (siteBindings != null && siteBindings.Count > 0)
            {
                site = iis.Sites.Add(siteName, "http", siteBindings.First(), siteRoot);
            }
            else
            {
                int sitePort = GetRandomPort(iis);
                site = iis.Sites.Add(siteName, siteRoot, sitePort);
            }

            site.ApplicationDefaults.ApplicationPoolName = pool.Name;

            if (_traceFailedRequests)
            {
                site.TraceFailedRequestsLogging.Enabled = true;
                string path = Path.Combine(_logPath, applicationName, "Logs");
                Directory.CreateDirectory(path);
                site.TraceFailedRequestsLogging.Directory = path;
            }

            return site;
        }
开发者ID:bogdansa,项目名称:kudu,代码行数:30,代码来源:SiteManager.cs


示例8: WaitForState

 public static void WaitForState(this IIS.ApplicationPool appPool, IIS.ObjectState state)
 {
     new PollingWait(() => { }, () => appPool.State == state).Invoke();
 }
开发者ID:remcoros,项目名称:kudu,代码行数:4,代码来源:IISExtensions.cs


示例9: NoHostNameFoundException

        private static IIS.Binding EnsureBinding(IIS.BindingCollection siteBindings)
        {
            if (siteBindings == null)
            {
                throw new NoHostNameFoundException();
            }

            IIS.Binding iisBinding = siteBindings.FirstOrDefault();

            if (iisBinding == null)
            {
                throw new NoHostNameFoundException();
            }

            return iisBinding;
        }
开发者ID:bogdansa,项目名称:kudu,代码行数:16,代码来源:SiteManager.cs


示例10: GetRandomPort

        private int GetRandomPort(IIS.ServerManager iis)
        {
            int randomPort = portNumberGenRnd.Next(1025, 65535);
            while (!IsAvailable(randomPort, iis))
            {
                randomPort = portNumberGenRnd.Next(1025, 65535);
            }

            return randomPort;
        }
开发者ID:cburgdorf,项目名称:kudu,代码行数:10,代码来源:SiteManager.cs


示例11: ConfigurationElementContainsHostingStart

        private static bool ConfigurationElementContainsHostingStart(IIS.ConfigurationElement configurationElement)
        {
            object valueAttribute = configurationElement["value"];

            return valueAttribute != null && String.Equals(HostingStartHtml, valueAttribute.ToString(), StringComparison.OrdinalIgnoreCase);
        }
开发者ID:Walk4Muscle,项目名称:kudu,代码行数:6,代码来源:SiteManager.cs


示例12: IsAvailable

        private static bool IsAvailable(string host, int port, IIS.ServerManager iis)
        {
            foreach (var iisSite in iis.Sites)
            {
                foreach (var binding in iisSite.Bindings)
                {
                    if (binding.EndPoint != null && binding.EndPoint.Port == port && binding.Host == host)
                    {
                        return false;
                    }
                }
            }

            return true;
        }
开发者ID:albertjan,项目名称:kudu,代码行数:15,代码来源:SiteManager.cs


示例13: DeleteSite

 private void DeleteSite(IIS.ServerManager iis, string siteName, bool deletePhysicalFiles = true)
 {
     var site = iis.Sites[siteName];
     if (site != null)
     {
         site.StopAndWait();
         if (deletePhysicalFiles)
         {
             string physicalPath = site.Applications[0].VirtualDirectories[0].PhysicalPath;
             DeleteSafe(physicalPath);
         }
         iis.Sites.Remove(site);
     }
 }
开发者ID:cburgdorf,项目名称:kudu,代码行数:14,代码来源:SiteManager.cs


示例14: EnsureAppPool

        private static IIS.ApplicationPool EnsureAppPool(IIS.ServerManager iis)
        {
            var kuduAppPool = iis.ApplicationPools["kudu"];
            if (kuduAppPool == null) {
                iis.ApplicationPools.Add("kudu");
                iis.CommitChanges();
                kuduAppPool = iis.ApplicationPools["kudu"];
                kuduAppPool.Enable32BitAppOnWin64 = true;
                kuduAppPool.ManagedPipelineMode = IIS.ManagedPipelineMode.Integrated;
                kuduAppPool.ManagedRuntimeVersion = "v4.0";
                kuduAppPool.AutoStart = true;
            }

            return kuduAppPool;
        }
开发者ID:RaleighHokie,项目名称:kudu,代码行数:15,代码来源:SiteManager.cs


示例15: EnsureAppPool

        private static IIS.ApplicationPool EnsureAppPool(IIS.ServerManager iis, string appName)
        {
            string appPoolName = GetAppPool(appName);
            var kuduAppPool = iis.ApplicationPools[appPoolName];
            if (kuduAppPool == null)
            {
                iis.ApplicationPools.Add(appPoolName);
                iis.CommitChanges();
                kuduAppPool = iis.ApplicationPools[appPoolName];
                kuduAppPool.ManagedPipelineMode = IIS.ManagedPipelineMode.Integrated;
                kuduAppPool.ManagedRuntimeVersion = "v4.0";
                kuduAppPool.AutoStart = true;
                kuduAppPool.ProcessModel.LoadUserProfile = true;
            }

            EnsureDefaultDocument(iis);

            return kuduAppPool;
        }
开发者ID:albertjan,项目名称:kudu,代码行数:19,代码来源:SiteManager.cs


示例16: GetServiceSite

 private IIS.Site GetServiceSite(IIS.ServerManager iis, IIS.ApplicationPool appPool)
 {
     var site = iis.Sites["kudu_services"];
     if (site == null) {
         site = iis.Sites.Add("kudu_services", ServiceSitePath, GetRandomPort());
         site.ApplicationDefaults.ApplicationPoolName = appPool.Name;
     }
     return site;
 }
开发者ID:RaleighHokie,项目名称:kudu,代码行数:9,代码来源:SiteManager.cs


示例17: WaitForState

 public static async Task WaitForState(this IIS.Site site, IIS.ObjectState state)
 {
     await WaitForState(() => site.State, state);
 }
开发者ID:robzelt,项目名称:kudu,代码行数:4,代码来源:IISExtensions.cs


示例18: MapServiceSitePath

        private static void MapServiceSitePath(IIS.ServerManager iis, string applicationName, string path, string siteRoot)
        {
            string serviceSiteName = GetServiceSite(applicationName);

            // Get the service site
            IIS.Site site = iis.Sites[serviceSiteName];
            if (site == null)
            {
                throw new InvalidOperationException("Could not retrieve service site");
            }

            // Map the path to the live site in the service site
            site.Applications.Add(path, siteRoot);
        }
开发者ID:cburgdorf,项目名称:kudu,代码行数:14,代码来源:SiteManager.cs


示例19: DeleteSiteAsync

        private static Task DeleteSiteAsync(IIS.ServerManager iis, string siteName, bool deletePhysicalFiles = true)
        {
            var site = iis.Sites[siteName];
            if (site != null)
            {
                return OperationManager.AttemptAsync(async () =>
                {
                    await Task.Run(() =>
                    {
                        if (deletePhysicalFiles)
                        {
                            string physicalPath = site.Applications[0].VirtualDirectories[0].PhysicalPath;
                            DeleteSafe(physicalPath);
                        }
                        iis.Sites.Remove(site);
                    });
                });
            }

            return Task.FromResult(0);
        }
开发者ID:albertjan,项目名称:kudu,代码行数:21,代码来源:SiteManager.cs


示例20: CreateSite

        private int CreateSite(IIS.ServerManager iis, string applicationName, string siteName, string siteRoot)
        {
            var pool = EnsureAppPool(iis, applicationName);

            int sitePort = GetRandomPort(iis);
            var site = iis.Sites.Add(siteName, siteRoot, sitePort);
            site.ApplicationDefaults.ApplicationPoolName = pool.Name;

            if (_traceFailedRequests)
            {
                site.TraceFailedRequestsLogging.Enabled = true;
                string path = Path.Combine(_logPath, applicationName, "Logs");
                Directory.CreateDirectory(path);
                site.TraceFailedRequestsLogging.Directory = path;
            }

            return sitePort;
        }
开发者ID:cburgdorf,项目名称:kudu,代码行数:18,代码来源:SiteManager.cs



注:本文中的Microsoft.Web.Administration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Win32.OpenFileDialog类代码示例发布时间:2022-05-24
下一篇:
C# TestTools.UnitTesting类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap