public void StopServer()
 {
     if (server != null) {
         server.Stop();
         Debug.WriteLine("Server stopped");
     }
     server = null;
 }
 public void StartServer()
 {
     SiteCreator site = new SiteCreator().Create();
     site.WriteWebConfig(new WebConfigBuilder(ResizerSectionContents()).Build());
     string path = site.dir;
     server = new ServerFactory().CreateAndStart(path, "/");
     Debug.WriteLine("Located at " + path);
 }
示例#3
0
 public Server CreateAndStart(string physicalPath, string virtualPath, int retryCount = 2)
 {
     //49152 through 65535 are valid port numbers
     //Try 2 port numbers, then fail if we still can't start the server.
     for (int i = 0; i < retryCount; i++){
         int port = new Random().Next(49152, 65535);
         try {
             Server server = new Server(port, virtualPath, physicalPath);
             server.Start();
             return server;
         }catch(Exception e){
             if (i + 1 == retryCount) throw e;//On the last iteration, rethrow the exception.
         }
     }
     return null;
 }
示例#4
0
 internal Connection(Server server, Socket socket)
 {
     _server = server;
     _socket = socket;
 }
示例#5
0
文件: Request.cs 项目: eakova/resizer
 public Request(Server server, Host host, Connection connection)
     : base(String.Empty, String.Empty, null)
 {
     _server = server;
     _host = host;
     _connection = connection;
 }
示例#6
0
        public void Configure(Server server, int port, string virtualPath, string physicalPath)
        {
            _server = server;

            _port = port;
            _installPath = null;
            _virtualPath = virtualPath;

            _lowerCasedVirtualPath = CultureInfo.InvariantCulture.TextInfo.ToLower(_virtualPath);
            _lowerCasedVirtualPathWithTrailingSlash = virtualPath.EndsWith("/", StringComparison.Ordinal) ? virtualPath : virtualPath + "/";
            _lowerCasedVirtualPathWithTrailingSlash = CultureInfo.InvariantCulture.TextInfo.ToLower(_lowerCasedVirtualPathWithTrailingSlash);
            _physicalPath = physicalPath;
            _physicalClientScriptPath = HttpRuntime.AspClientScriptPhysicalPath + "\\";
            _lowerCasedClientScriptPathWithTrailingSlash = CultureInfo.InvariantCulture.TextInfo.ToLower(HttpRuntime.AspClientScriptVirtualPath + "/");
        }