Merge pull request #309 from stackia/master

Add an option to switch WCF metadata publishing
This commit is contained in:
Łukasz Domeradzki
2016-07-28 18:04:29 +02:00
committed by GitHub
2 changed files with 10 additions and 3 deletions

View File

@@ -105,7 +105,7 @@ namespace ArchiSteamFarm {
[JsonProperty(Required = Required.DisallowNull)]
internal readonly ushort WCFPort = DefaultWCFPort;
[JsonProperty(Required = Required.DisallowNull)]
[JsonProperty(Required = Required.DisallowNull)]
internal readonly bool Statistics = true;
[JsonProperty(Required = Required.DisallowNull)]

View File

@@ -26,6 +26,7 @@ using System;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
namespace ArchiSteamFarm {
[ServiceContract]
@@ -87,8 +88,14 @@ namespace ArchiSteamFarm {
}
Logging.LogGenericInfo("Starting WCF server...");
ServiceHost = new ServiceHost(typeof(WCF));
ServiceHost.AddServiceEndpoint(typeof(IWCF), new BasicHttpBinding(), URL);
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 {
ServiceHost.Open();