Beispiel #1
0
        public void Configure(AppHosts appHosts, int port, string virtualPath, string physicalPath,
                              bool requireAuthentication, bool disableDirectoryListing)
        {
            _appHosts = appHosts;

            _port                    = port;
            _installPath             = null;
            _virtualPath             = virtualPath;
            _requireAuthentication   = requireAuthentication;
            _disableDirectoryListing = disableDirectoryListing;
            _lowerCasedVirtualPath   = CultureInfo.InvariantCulture.TextInfo.ToLower(_virtualPath);
            _lowerCasedVirtualPathWithTrailingSlash = virtualPath.EndsWith("/", StringComparison.Ordinal)
                                                          ? virtualPath
                                                          : virtualPath + "/";
            _lowerCasedVirtualPathWithTrailingSlash =
                CultureInfo.InvariantCulture.TextInfo.ToLower(_lowerCasedVirtualPathWithTrailingSlash);
            _physicalPath             = physicalPath;
            _physicalClientScriptPath = HttpRuntime.AspClientScriptPhysicalPath + Path.DirectorySeparatorChar;
            _lowerCasedClientScriptPathWithTrailingSlash =
                CultureInfo.InvariantCulture.TextInfo.ToLower(HttpRuntime.AspClientScriptVirtualPath + "/");

            //var target = new NLogTarget();

            //NLog.Config.SimpleConfigurator.ConfigureForTargetLogging(target, LogLevel.Debug);
        }
Beispiel #2
0
        ///<summary>
        ///</summary>
        ///<param name="port"></param>
        ///<param name="virtualPath"></param>
        ///<param name="physicalPath"></param>
        ///<param name="requireAuthentication"></param>
        ///<param name="disableDirectoryListing"></param>
        public Server(int port, string virtualPath, string physicalPath, bool requireAuthentication,
                      bool disableDirectoryListing)
        {
            try
            {
                Assembly.ReflectionOnlyLoad("Common.Logging");
                _useLogger = true;
            }
            // ReSharper disable EmptyGeneralCatchClause
            catch
            // ReSharper restore EmptyGeneralCatchClause
            {
            }
            _ipAddress               = IPAddress.Loopback;
            _requireAuthentication   = requireAuthentication;
            _disableDirectoryListing = disableDirectoryListing;
            _lockObject              = new object();
            _port         = port;
            _virtualPath  = virtualPath;
            _physicalPath = Path.GetFullPath(physicalPath);

            var dirSeparator = Path.DirectorySeparatorChar.ToString();

            _physicalPath = _physicalPath.EndsWith(dirSeparator, StringComparison.Ordinal)
                                ? _physicalPath
                                : _physicalPath + dirSeparator;
            ProcessConfiguration();

            string uniqueAppString = string.Concat(virtualPath, physicalPath, ":", _port.ToString()).ToLowerInvariant();

            _appId = (uniqueAppString.GetHashCode()).ToString("x", CultureInfo.InvariantCulture);
            ObtainProcessToken();

            _appHosts = new AppHosts(this, _virtualPath, _physicalPath);

            _appHosts.HostCreated += (s, e) =>
            {
                if (HostCreated != null)
                {
                    HostCreated.Invoke(s, e);
                }
            };

            _appHosts.HostRemoved += (s, e) =>
            {
                if (HostRemoved != null)
                {
                    HostRemoved.Invoke(s, e);
                }
            };

#if NET40
            //m_projMonitor = new HostWatchManager();
            //m_projMonitor.AddSolution(@"D:\Users\mantasi\Documents\Visual Studio 2010\Projects\Core\Core.sln");
#endif
        }
Beispiel #3
0
 ///<summary>
 ///</summary>
 public void HostStopped()
 {
     _appHosts = null;
 }
 public ConfigMapPathFactory(AppHosts appHosts)
 {
     _appHosts = appHosts;
 }
Beispiel #5
0
 public void Configure(AppHosts appHosts, int port, string virtualPath, string physicalPath)
 {
     Configure(appHosts, port, virtualPath, physicalPath, false, false);
 }
Beispiel #6
0
 public void Configure(AppHosts appHosts, int port, string virtualPath, string physicalPath,
                       bool requireAuthentication)
 {
     Configure(appHosts, port, virtualPath, physicalPath, requireAuthentication, false);
 }