示例#1
0
        /// <inheritdoc/>
        public override void StartHostingService()
        {
            if (IsHostingServiceRunning)
            {
                return;
            }

            if (HostingServicePort <= 0)
            {
                HostingServicePort = GetAvailablePort();
            }
            else if (!IsPortAvailable(HostingServicePort))
            {
                LogError("Port {0} is in use, cannot start service!", HostingServicePort);
                return;
            }

            if (HostingServiceContentRoots.Count == 0)
            {
                throw new Exception(
                          "ContentRoot is not configured; cannot start service. This can usually be fixed by modifying the BuildPath for any new groups and/or building content.");
            }

            ConfigureHttpListener();
            MyHttpListener.Start();
            MyHttpListener.BeginGetContext(HandleRequest, null);
            Log("Started. Listening on port {0}", HostingServicePort);
        }
示例#2
0
    /// <inheritdoc />
    public override void StartHostingService()
    {
        if (IsHostingServiceRunning)
        {
            return;
        }

        if (HostingServicePort <= 0)
        {
            HostingServicePort = GetAvailablePort();
        }
        else if (!IsPortAvailable(HostingServicePort))
        {
            LogError("Port {0} is in use, cannot start service!", HostingServicePort);
            return;
        }

        if (HostingServiceContentRoots.Count == 0)
        {
            throw new Exception(
                      "ContentRoot is not configured; cannot start service. This can usually be fixed by modifying the BuildPath for any new groups and/or building content.");
        }

        ConfigureHttpListener();
        MyHttpListener.Start();
        MyHttpListener.BeginGetContext(HandleRequest, null);
        Log("Started. Listening on port {0}", HostingServicePort);

        //
        if (socketListener == null)
        {
            socketListener = new AsyncSocketServer();
        }
        var socketLocalEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), HotfixManager.Instance.ipPort);

        socketListener.Start(socketLocalEndPoint);
    }