|
|
@ -1,5 +1,6 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Net; |
|
|
|
using System.Text; |
|
|
|
|
|
|
|
#if NETFX
|
|
|
@ -62,15 +63,20 @@ namespace Apewer.Web |
|
|
|
static MiniServer _mini = null; |
|
|
|
|
|
|
|
/// <summary>启动 Mini 服务器,返回错误消息。</summary>
|
|
|
|
public static string Mini(int port = 80, bool await = true) |
|
|
|
public static string Mini(IPEndPoint endpoint, bool await = true) |
|
|
|
{ |
|
|
|
if (endpoint == null) throw new ArgumentNullException(nameof(endpoint)); |
|
|
|
|
|
|
|
if (_mini != null) return "无法重复启动实例。"; |
|
|
|
_mini = new MiniServer(); |
|
|
|
_mini.Handler = context => _invoker.Invoke(new MiniProvider(context)); |
|
|
|
_mini.Run(port, await); |
|
|
|
_mini.Run(endpoint, await); |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>启动 Mini 服务器,返回错误消息。</summary>
|
|
|
|
public static string Mini(int port = 80, bool await = true) => Mini(new IPEndPoint(IPAddress.Any, port)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#if NETCORE
|
|
|
@ -124,7 +130,7 @@ namespace Apewer.Web |
|
|
|
public partial class ApiProgram : IHttpHandler, IHttpModule |
|
|
|
{ |
|
|
|
|
|
|
|
#region IHttpHandler
|
|
|
|
#region IHttpHandler
|
|
|
|
|
|
|
|
static bool _initialized = false; |
|
|
|
|
|
|
@ -142,9 +148,9 @@ namespace Apewer.Web |
|
|
|
_invoker.Invoke(new WebsiteProvider(context)); |
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region IHttpModule
|
|
|
|
#region IHttpModule
|
|
|
|
|
|
|
|
/// <summary></summary>
|
|
|
|
public void Dispose() { } |
|
|
@ -171,7 +177,7 @@ namespace Apewer.Web |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|