I'm currently running a sandbox Web Server on my local machine & using my Application, I am grabbing the contents of a text file (currently single line) and displaying it back onto the main form.
When the Web Server is alive, the application will run normally, which is as expected. When the web server is down, the application refuses to open.. Let alone spawn the process.
I thought i was approaching the application correctly. I've used a try catch
block in the event that the web server is down. The code is to follow:
public String UpdaterURL = "http://192.168.0.12/DestinyScreening/Updater/Revision.txt";
public int UpdaterVersion(int CurrentVersion)
{
try
{
var RemoteRevision = (new WebClient()).DownloadString(UpdaterURL);
return Int32.Parse(RemoteRevision);
}
catch
{
var Date = DateTime.Now.ToString("yyyy-MM-dd");
var Time = DateTime.Now.ToString("HH:mm");
StreamWriter file = new StreamWriter("ErrorReports\\" + Date + ".txt",true);
file.WriteLine(Time + " - Could Not Contact Update Server");
file.Close();
return CurrentVersion;
}
}
Now, when I say the application does not run. It essentially does run in Debug mode via Visual Studio.. I have swapped from Debug to Release and built the solution, which running the executable does not run.
I've trawled through the code provided, everything works as expected. It's just a complete baffle to me, as to why the application does not spawn a process when double clicking the exe?
So, the overall question. With everything which looks like is running as normal through debug mode on Visual Studio.. What could be going on behind the scenes which will stop a process from spawning?
I'm unable to trace this error as it's to do with the release build (double clicking the executable not running through Visual studio). Event Viewer shows the following (which is of no use):
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Application Error" />
<EventID Qualifiers="0">1000</EventID>
<Level>2</Level>
<Task>100</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2015-10-13T22:54:20.000000000Z" />
<EventRecordID>12976</EventRecordID>
<Channel>Application</Channel>
<Computer>Daryls8</Computer>
<Security />
</System>
<EventData>
<Data>DestinyScreening.exe</Data>
<Data>1.0.0.0</Data>
<Data>561d8b7c</Data>
<Data>KERNELBASE.dll</Data>
<Data>10.0.10240.16384</Data>
<Data>559f3b2a</Data>
<Data>e0434352</Data>
<Data>000b3e28</Data>
<Data>20bc</Data>
<Data>01d1060a17c9bb47</Data>
<Data>C:\Users\Daryl\Documents\Visual Studio 2015\Projects\DestinyScreening\DestinyScreening\bin\Release\DestinyScreening.exe</Data>
<Data>C:\WINDOWS\SYSTEM32\KERNELBASE.dll</Data>
<Data>0ba5af44-c01c-4d4f-a318-855d84d4148e</Data>
<Data />
<Data />
</EventData>
</Event>