Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/24/10 18:37:04 (14 years ago)
Author:
cneumuel
Message:

added streamedHttpEndpoit binding (without message-security (for now)) (#1168)

Location:
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3
Files:
2 added
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/HeuristicLab.Hive.Experiment-3.3.csproj

    r4296 r4305  
    8585    <Reference Include="System.Core" />
    8686    <Reference Include="System.Drawing" />
     87    <Reference Include="System.Runtime.Serialization" />
    8788    <Reference Include="System.ServiceModel" />
    8889    <Reference Include="System.Xml.Linq" />
     
    104105    </Compile>
    105106    <Compile Include="ServiceLocator.cs" />
    106     <Compile Include="Settings.cs" />
    107107  </ItemGroup>
    108108  <ItemGroup>
     
    113113    <None Include="Properties\AssemblyInfo.frame" />
    114114    <None Include="Properties\Settings.settings">
    115       <Generator>SettingsSingleFileGenerator</Generator>
     115      <Generator>PublicSettingsSingleFileGenerator</Generator>
    116116      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    117117    </None>
     118    <None Include="Tools\RecreateServiceConfig.bat" />
    118119  </ItemGroup>
    119120  <ItemGroup>
     
    130131      <Name>HeuristicLab.Hive.JobBase-3.3</Name>
    131132    </ProjectReference>
     133  </ItemGroup>
     134  <ItemGroup>
     135    <WCFMetadata Include="Service References\" />
    132136  </ItemGroup>
    133137  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/HiveExperiment.cs

    r4302 r4305  
    4343using System.ServiceModel;
    4444using HeuristicLab.Hive.Contracts.ResponseObjects;
     45using HeuristicLab.Hive.Experiment.Properties;
    4546
    4647namespace HeuristicLab.Hive.Experiment {
     
    9091      }
    9192    }
    92    
     93
    9394    #region Storable Properties
    9495    [Storable]
     
    114115    public JobItemList JobItems {
    115116      get { return jobItems; }
    116     }
    117 
    118 
    119     [Storable]
    120     private string serverUrl;
    121     public string ServerUrl {
    122       get { return serverUrl; }
    123       set {
    124         if (serverUrl != value) {
    125           serverUrl = value;
    126           OnServerUrlChanged();
    127         }
    128       }
    129117    }
    130118
     
    191179    public HiveExperiment()
    192180      : base(itemName, itemDescription) {
    193       this.ServerUrl = HeuristicLab.Hive.Experiment.Properties.Settings.Default.HiveServerUrl;
    194181      this.ResourceIds = HeuristicLab.Hive.Experiment.Properties.Settings.Default.ResourceIds;
    195182      this.log = new Log();
     
    205192      HiveExperiment clone = (HiveExperiment)base.Clone(cloner);
    206193      clone.resourceIds = this.resourceIds;
    207       clone.serverUrl = this.serverUrl;
    208194      clone.experiment = (HeuristicLab.Optimization.Experiment)cloner.Clone(experiment);
    209195      clone.executionState = this.executionState;
     
    279265
    280266      Thread t = new Thread(() => {
    281         IClientFacade clientFacade = GetClientFacade();
     267        IClientFacade clientFacade = CreateStreamedClientFacade();
    282268
    283269        try {
     
    307293            LogMessage(jobItem.JobDto.Id, "Job sent to Hive");
    308294          }
    309         } catch (Exception e) {
     295        }
     296        catch (Exception e) {
    310297          LogMessage("Error: Starting HiveExperiment failed: " + e.Message);
    311298          this.ExecutionState = Core.ExecutionState.Stopped;
     
    468455    private void FetchAndUpdateJob(Guid jobId) {
    469456      LogMessage(jobId, "FetchAndUpdateJob started");
    470       IClientFacade clientFacade = GetClientFacade();
     457      IClientFacade clientFacade = CreateStreamedClientFacade();
    471458      IOptimizer originalOptimizer;
    472459      lock (pendingOptimizersByJobId) {
     
    490477
    491478    public void AbortJob(Guid jobId) {
    492       IClientFacade clientFacade = GetClientFacade();
     479      IClientFacade clientFacade = CreateClientFacade();
    493480      Response response = clientFacade.AbortJob(jobId);
    494481      LogMessage(jobId, "Aborting Job: " + response.StatusMessage);
     
    554541        try {
    555542          do {
    556             IClientFacade clientFacade = GetClientFacade();
     543            IClientFacade clientFacade = CreateStreamedClientFacade();
    557544            IEnumerable<Guid> jobIdsToQuery = from job in JobItems
    558545                                              where job.State != JobState.Finished &&
     
    571558                  throw new Exception(response.StatusMessage.ToString());
    572559                }
    573               } catch (Exception e) {
     560              }
     561              catch (Exception e) {
    574562                LogMessage("Polling results failed: " + e.Message);
    575563              }
     
    582570            }
    583571          } while (!this.stopResultsPollingPending);
    584         } catch (ThreadInterruptedException exception) {
     572        }
     573        catch (ThreadInterruptedException exception) {
    585574          // thread has been interuppted
    586         } finally {
     575        }
     576        finally {
    587577          this.IsPollingResults = false;
    588578        }
     
    601591    public void RequestSnapshot(Guid jobId) {
    602592      Thread t = new Thread(() => {
    603         IClientFacade clientFacade = GetClientFacade();
     593        IClientFacade clientFacade = CreateStreamedClientFacade();
    604594        ResponseObject<SerializedJob> response;
    605595        int retryCount = 0;
     
    876866
    877867    #region Helper Functions
    878     private IClientFacade GetClientFacade() {
     868    private IClientFacade CreateClientFacade() {
    879869      IClientFacade clientFacade = null;
    880870      do {
    881871        try {
    882           clientFacade = ServiceLocator.CreateClientFacade(ServerUrl);
     872          clientFacade = ServiceLocator.CreateClientFacade(string.Format("http://{0}:{1}/{2}", Settings.Default.HiveServerIp, Settings.Default.HiveServerPort, WcfSettings.ClientServiceName));
     873
    883874        } catch (EndpointNotFoundException exception) {
    884875          LogMessage("Could not connect to Server: " + exception.Message + ". Will try again in " + (resultPollingIntervalMs / 1000) + " sec.");
     
    889880    }
    890881
     882    private IClientFacade CreateStreamedClientFacade() {
     883      IClientFacade clientFacade = null;
     884      do {
     885        try {
     886          clientFacade = ServiceLocator.CreateStreamedClientFacade(string.Format("http://{0}:{1}/{2}", Settings.Default.HiveServerIp, Settings.Default.HiveServerPort, WcfSettings.ClientStreamedServiceName));
     887
     888        } catch (EndpointNotFoundException exception) {
     889          LogMessage("Could not connect to Server: " + exception.Message + ". Will try again in " + (resultPollingIntervalMs / 1000) + " sec.");
     890          Thread.Sleep(resultPollingIntervalMs);
     891        }
     892      } while (clientFacade == null && this.ExecutionState != Core.ExecutionState.Stopped);
     893      return clientFacade;
     894    }
    891895
    892896    private void AddRange(IDictionary<IOptimizer, IOptimizer> optimizers, IDictionary<IOptimizer, IOptimizer> childs) {
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/Properties/Settings.Designer.cs

    r4116 r4305  
    1414    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    1515    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
    16     internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
     16    public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
    1717       
    1818        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
     
    2121            get {
    2222                return defaultInstance;
    23             }
    24         }
    25        
    26         [global::System.Configuration.UserScopedSettingAttribute()]
    27         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    28         [global::System.Configuration.DefaultSettingValueAttribute("net.tcp://10.42.1.153:9000/ExecutionEngine/ExecutionEngineFacade")]
    29         public string HiveServerUrl {
    30             get {
    31                 return ((string)(this["HiveServerUrl"]));
    32             }
    33             set {
    34                 this["HiveServerUrl"] = value;
    3523            }
    3624        }
     
    4735            }
    4836        }
     37       
     38        [global::System.Configuration.UserScopedSettingAttribute()]
     39        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     40        [global::System.Configuration.DefaultSettingValueAttribute("localhost")]
     41        public string HiveServerIp {
     42            get {
     43                return ((string)(this["HiveServerIp"]));
     44            }
     45            set {
     46                this["HiveServerIp"] = value;
     47            }
     48        }
     49       
     50        [global::System.Configuration.UserScopedSettingAttribute()]
     51        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     52        [global::System.Configuration.DefaultSettingValueAttribute("cneumueller")]
     53        public string HiveUsername {
     54            get {
     55                return ((string)(this["HiveUsername"]));
     56            }
     57            set {
     58                this["HiveUsername"] = value;
     59            }
     60        }
     61       
     62        [global::System.Configuration.UserScopedSettingAttribute()]
     63        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     64        [global::System.Configuration.DefaultSettingValueAttribute("cneumueller")]
     65        public string HivePassword {
     66            get {
     67                return ((string)(this["HivePassword"]));
     68            }
     69            set {
     70                this["HivePassword"] = value;
     71            }
     72        }
     73       
     74        [global::System.Configuration.UserScopedSettingAttribute()]
     75        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     76        [global::System.Configuration.DefaultSettingValueAttribute("9000")]
     77        public string HiveServerPort {
     78            get {
     79                return ((string)(this["HiveServerPort"]));
     80            }
     81            set {
     82                this["HiveServerPort"] = value;
     83            }
     84        }
    4985    }
    5086}
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/Properties/Settings.settings

    r4116 r4305  
    33  <Profiles />
    44  <Settings>
    5     <Setting Name="HiveServerUrl" Type="System.String" Scope="User">
    6       <Value Profile="(Default)">net.tcp://10.42.1.153:9000/ExecutionEngine/ExecutionEngineFacade</Value>
    7     </Setting>
    85    <Setting Name="ResourceIds" Type="System.String" Scope="User">
    96      <Value Profile="(Default)">MyGroup</Value>
    107    </Setting>
     8    <Setting Name="HiveServerIp" Type="System.String" Scope="User">
     9      <Value Profile="(Default)">localhost</Value>
     10    </Setting>
     11    <Setting Name="HiveUsername" Type="System.String" Scope="User">
     12      <Value Profile="(Default)">cneumueller</Value>
     13    </Setting>
     14    <Setting Name="HivePassword" Type="System.String" Scope="User">
     15      <Value Profile="(Default)">cneumueller</Value>
     16    </Setting>
     17    <Setting Name="HiveServerPort" Type="System.String" Scope="User">
     18      <Value Profile="(Default)">9000</Value>
     19    </Setting>
    1120  </Settings>
    1221</SettingsFile>
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/ServiceLocator.cs

    r4302 r4305  
    2727using System.ServiceModel;
    2828using HeuristicLab.Hive.Contracts;
     29using HeuristicLab.Hive.Experiment.Properties;
    2930
    3031namespace HeuristicLab.Hive.Experiment {
    3132  internal class ServiceLocator {
    3233    internal static IClientFacade CreateClientFacade(string url) {
    33       ChannelFactory<IClientFacade> factory = new ChannelFactory<IClientFacade>(
    34           WcfSettings.GetStreamedBinding(),
    35           new EndpointAddress(url));
    36       return factory.CreateChannel();
     34      ChannelFactory<IClientFacade> factory = new ChannelFactory<IClientFacade>("ClientHttpEndpoint");
     35      WcfSettings.SetEndpointAddress(factory.Endpoint, url);
     36
     37      factory.Credentials.UserName.UserName = Settings.Default.HiveUsername;
     38      factory.Credentials.UserName.Password = Settings.Default.HivePassword;
     39
     40      IClientFacade client = factory.CreateChannel();
     41      return client;
     42    }
     43
     44    internal static IClientFacade CreateStreamedClientFacade(string url) {
     45      ChannelFactory<IClientFacade> factory = new ChannelFactory<IClientFacade>("ClientStreamedHttpEndpoint");
     46      WcfSettings.SetEndpointAddress(factory.Endpoint, url);
     47
     48      factory.Credentials.UserName.UserName = Settings.Default.HiveUsername;
     49      factory.Credentials.UserName.Password = Settings.Default.HivePassword;
     50
     51      IClientFacade client = factory.CreateChannel();
     52      return client;
    3753    }
    3854  }
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/app.config

    r4170 r4305  
    88  <userSettings>
    99    <HeuristicLab.Hive.Experiment.Properties.Settings>
    10       <setting name="HiveServerUrl" serializeAs="String">
    11         <value>net.tcp://10.20.71.22:9000/ExecutionEngine/ExecutionEngineFacade</value>
    12       </setting>
    1310      <setting name="ResourceIds" serializeAs="String">
    1411        <value>MyGroup</value>
    1512      </setting>
     13      <setting name="HiveServerIp" serializeAs="String">
     14        <value>localhost</value>
     15      </setting>
     16      <setting name="HiveUsername" serializeAs="String">
     17        <value>cneumueller</value>
     18      </setting>
     19      <setting name="HivePassword" serializeAs="String">
     20        <value>cneumueller</value>
     21      </setting>
     22      <setting name="HiveServerPort" serializeAs="String">
     23        <value>9000</value>
     24      </setting>
    1625    </HeuristicLab.Hive.Experiment.Properties.Settings>
    1726  </userSettings>
     27  <system.serviceModel>
     28
     29    <bindings>
     30      <basicHttpBinding>
     31        <binding name="ClientStreamedHttpEndpoint" closeTimeout="00:01:00"
     32            openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
     33            allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
     34            maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
     35            messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
     36            useDefaultWebProxy="true">
     37          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
     38              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
     39          <security mode="None">
     40            <transport clientCredentialType="None" proxyCredentialType="None"
     41                realm="" />
     42            <message clientCredentialType="UserName" algorithmSuite="Default" />
     43          </security>
     44        </binding>
     45      </basicHttpBinding>
     46      <wsHttpBinding>
     47        <binding name="ClientHttpEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00"
     48            receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
     49            transactionFlow="false" hostNameComparisonMode="StrongWildcard"
     50            maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
     51            messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
     52            allowCookies="false">
     53          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
     54              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
     55          <reliableSession ordered="true" inactivityTimeout="00:10:00"
     56              enabled="false" />
     57          <security mode="Message">
     58            <transport clientCredentialType="Windows" proxyCredentialType="None"
     59                realm="" />
     60            <message clientCredentialType="UserName" negotiateServiceCredential="true"
     61                algorithmSuite="Default" />
     62          </security>
     63        </binding>
     64        <binding name="ClientMexEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00"
     65            receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
     66            transactionFlow="false" hostNameComparisonMode="StrongWildcard"
     67            maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
     68            messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
     69            allowCookies="false">
     70          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
     71              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
     72          <reliableSession ordered="true" inactivityTimeout="00:10:00"
     73              enabled="false" />
     74          <security mode="None">
     75            <transport clientCredentialType="Windows" proxyCredentialType="None"
     76                realm="" />
     77            <message clientCredentialType="Windows" negotiateServiceCredential="true" />
     78          </security>
     79        </binding>
     80      </wsHttpBinding>
     81    </bindings>
     82    <client>
     83      <endpoint address="http://localhost:9000/ClientService" behaviorConfiguration="ClientServiceBehaviour" binding="wsHttpBinding"
     84          bindingConfiguration="ClientHttpEndpoint" contract="HeuristicLab.Hive.Contracts.Interfaces.IClientFacade"
     85          name="ClientHttpEndpoint">
     86        <identity>
     87          <certificate encodedValue="AwAAAAEAAAAUAAAAeBLH/0jWrlsW42fIC8VIIdAE6PUgAAAAAQAAAPIBAAAwggHuMIIBW6ADAgECAhDez3CoJIIitEZ5xwVqLJn6MAkGBSsOAwIdBQAwFDESMBAGA1UEAxMJbG9jYWxob3N0MB4XDTEwMDgyMzE1NTg0OFoXDTM5MTIzMTIzNTk1OVowFDESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCmOgweB6X4Ss6W2xb2hg1x61cjD2T7SO0ckkzmtqRhC2UWly9dBnonFJmg9RjN0y6l2tZhVzNhq8DgCkn3hPg5GL3XIwYX4PsXwNmeT6i+7s6rGbESuaEMvYOAQJSJ+MTgBvXCwo2g5nFHIBqP4W4aU2eybxP7H4cm1rQpoYHHjQIDAQABo0kwRzBFBgNVHQEEPjA8gBASDhO/IE7Ff7PpkCVF8oUpoRYwFDESMBAGA1UEAxMJbG9jYWxob3N0ghDez3CoJIIitEZ5xwVqLJn6MAkGBSsOAwIdBQADgYEAhxAzm3JTV7j51jti5P7izTEs7+8534kQloeAJDwlKolkd4ZMkf0BiexC2Vt1KsnxUjrK0HbbITzazkvkAmKi7dP+4G+3SrWag5lS4NcoPjTQy16T3zC9E6yafRaZp1/pxjC3Ap44qwq4Kjl2mEjeHHsdie/h4loowTqC9FlLbgo=" />
     88        </identity>
     89      </endpoint>
     90      <endpoint address="http://localhost:9000/ClientService/mex" binding="wsHttpBinding"
     91          bindingConfiguration="ClientMexEndpoint" contract="HeuristicLab.Hive.Contracts.Interfaces.IClientFacade"
     92          name="ClientMexEndpoint" />
     93      <endpoint address="http://localhost:9000/ClientServiceStreamed"
     94          binding="basicHttpBinding" bindingConfiguration="ClientStreamedHttpEndpoint"
     95          contract="HeuristicLab.Hive.Contracts.Interfaces.IClientFacade" name="ClientStreamedHttpEndpoint" />
     96    </client>
     97   
     98    <behaviors>
     99      <endpointBehaviors>
     100        <behavior name="ClientServiceBehaviour">
     101          <clientCredentials>
     102            <serviceCertificate>
     103              <authentication certificateValidationMode="None" />
     104            </serviceCertificate>
     105          </clientCredentials>
     106        </behavior>
     107      </endpointBehaviors>
     108    </behaviors>
     109
     110  </system.serviceModel>
    18111</configuration>
Note: See TracChangeset for help on using the changeset viewer.