Adding exception at used REST port problem
This commit is contained in:
parent
46ab25de58
commit
4f914fc4c9
1 changed files with 9 additions and 1 deletions
|
|
@ -79,12 +79,20 @@ namespace Rests
|
|||
|
||||
public virtual void Start()
|
||||
{
|
||||
if (listener == null)
|
||||
try
|
||||
{
|
||||
listener = HttpListener.Create(Ip, Port);
|
||||
listener.RequestReceived += OnRequest;
|
||||
listener.Start(int.MaxValue);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TShock.Log.Error("Fatal Startup Exception");
|
||||
TShock.Log.Error(ex.ToString());
|
||||
TShock.Log.ConsoleError("Invalid REST configuration: \nYou may already have a REST service bound to port {0}. \nPlease adjust your configuration and restart the server. \nPress any key to exit.", Port);
|
||||
Console.ReadLine();
|
||||
Environment.Exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public void Start(IPAddress ip, int port)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue