mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-16 08:25:28 +00:00
Style fixes + move ServiceHost to try block
This commit is contained in:
@@ -105,7 +105,7 @@ namespace ArchiSteamFarm {
|
|||||||
[JsonProperty(Required = Required.DisallowNull)]
|
[JsonProperty(Required = Required.DisallowNull)]
|
||||||
internal readonly ushort WCFPort = DefaultWCFPort;
|
internal readonly ushort WCFPort = DefaultWCFPort;
|
||||||
|
|
||||||
[JsonProperty(Required = Required.DisallowNull)]
|
[JsonProperty(Required = Required.DisallowNull)]
|
||||||
internal readonly bool Statistics = true;
|
internal readonly bool Statistics = true;
|
||||||
|
|
||||||
[JsonProperty(Required = Required.DisallowNull)]
|
[JsonProperty(Required = Required.DisallowNull)]
|
||||||
|
|||||||
@@ -88,21 +88,18 @@ namespace ArchiSteamFarm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Logging.LogGenericInfo("Starting WCF server...");
|
Logging.LogGenericInfo("Starting WCF server...");
|
||||||
ServiceHost = new ServiceHost(typeof(WCF), new Uri(URL));
|
|
||||||
ServiceHost.Description.Behaviors.Add(new ServiceMetadataBehavior
|
|
||||||
{
|
|
||||||
HttpGetEnabled = true
|
|
||||||
});
|
|
||||||
ServiceHost.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName,
|
|
||||||
MetadataExchangeBindings.CreateMexHttpBinding(), "mex");
|
|
||||||
ServiceHost.AddServiceEndpoint(typeof(IWCF), new BasicHttpBinding(), string.Empty);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
ServiceHost = new ServiceHost(typeof(WCF), new Uri(URL));
|
||||||
|
|
||||||
|
ServiceHost.Description.Behaviors.Add(new ServiceMetadataBehavior {
|
||||||
|
HttpGetEnabled = true
|
||||||
|
});
|
||||||
|
|
||||||
|
ServiceHost.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, MetadataExchangeBindings.CreateMexHttpBinding(), "mex");
|
||||||
|
ServiceHost.AddServiceEndpoint(typeof(IWCF), new BasicHttpBinding(), string.Empty);
|
||||||
|
|
||||||
ServiceHost.Open();
|
ServiceHost.Open();
|
||||||
} catch (AddressAccessDeniedException) {
|
|
||||||
Logging.LogGenericWarning("WCF service could not be started because of AddressAccessDeniedException");
|
|
||||||
Logging.LogGenericWarning("If you want to use WCF service provided by ASF, consider starting ASF as administrator, or giving proper permissions");
|
|
||||||
return;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logging.LogGenericException(e);
|
Logging.LogGenericException(e);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user