Changeset 14732 for trunk/sources
- Timestamp:
- 03/08/17 11:21:07 (8 years ago)
- Location:
- trunk/sources/HeuristicLab.Clients.OKB/3.3
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Clients.OKB/3.3/HeuristicLab.Clients.OKB-3.3.csproj
r13691 r14732 114 114 <Compile Include="Administration\ServiceClient\ProblemClass.cs" /> 115 115 <Compile Include="OKBRoles.cs" /> 116 <Compile Include="Properties\Settings.Designer.cs"> 117 <AutoGen>True</AutoGen> 118 <DesignTimeSharedInput>True</DesignTimeSharedInput> 119 <DependentUpon>Settings.settings</DependentUpon> 120 </Compile> 116 121 <Compile Include="RunCreation\OKBSolution.cs" /> 117 122 <Compile Include="Plugin.cs" /> … … 177 182 <None Include="Properties\AssemblyInfo.cs.frame" /> 178 183 <None Include="Administration\ServiceClient\GenerateServiceClient.cmd" /> 184 <None Include="Properties\Settings.settings"> 185 <Generator>SettingsSingleFileGenerator</Generator> 186 <LastGenOutput>Settings.Designer.cs</LastGenOutput> 187 </None> 179 188 <None Include="Query\ServiceClient\GenerateServiceClient.cmd" /> 180 189 <None Include="RunCreation\ServiceClient\GenerateServiceClient.cmd" /> -
trunk/sources/HeuristicLab.Clients.OKB/3.3/Query/QueryClient.cs
r14185 r14732 24 24 using System.IO; 25 25 using System.Linq; 26 using System.ServiceModel; 26 27 using HeuristicLab.Clients.Common; 27 28 using HeuristicLab.Common; … … 39 40 } 40 41 } 42 43 private int endpointRetries; 44 private string workingEndpoint; 41 45 42 46 #region Properties … … 68 72 } 69 73 public void RefreshAsync(Action<Exception> exceptionCallback) { 70 var call = new Func<Exception>(delegate () {74 var call = new Func<Exception>(delegate () { 71 75 try { 72 76 Refresh(); … … 76 80 return null; 77 81 }); 78 call.BeginInvoke(delegate (IAsyncResult result) {82 call.BeginInvoke(delegate (IAsyncResult result) { 79 83 Exception ex = call.EndInvoke(result); 80 84 if (ex != null) exceptionCallback(ex); … … 156 160 157 161 #region Helpers 162 private QueryServiceClient NewServiceClient() { 163 if (endpointRetries >= Properties.Settings.Default.MaxEndpointRetries) 164 return CreateClient(workingEndpoint); 165 166 var configurations = Properties.Settings.Default.EndpointConfigurationPriorities; 167 Exception exception = null; 168 169 foreach (var endpointConfigurationName in configurations) { 170 try { 171 var cl = CreateClient(endpointConfigurationName); 172 cl.Open(); 173 workingEndpoint = endpointConfigurationName; 174 return cl; 175 } catch (EndpointNotFoundException e) { 176 exception = e; 177 ++endpointRetries; 178 } 179 } 180 181 throw exception ?? new EndpointNotFoundException("No endpoint for Query service found."); 182 } 183 184 private QueryServiceClient CreateClient(string endpointConfigurationName) { 185 var cl = ClientFactory.CreateClient<QueryServiceClient, IQueryService>(endpointConfigurationName); 186 return cl; 187 } 188 158 189 private T CallQueryService<T>(Func<IQueryService, T> call) { 159 QueryServiceClient client = ClientFactory.CreateClient<QueryServiceClient, IQueryService>(); 190 QueryServiceClient client = NewServiceClient(); 191 160 192 try { 161 193 return call(client); -
trunk/sources/HeuristicLab.Clients.OKB/3.3/app.config
r11623 r14732 1 1 <?xml version="1.0" encoding="utf-8"?> 2 2 <configuration> 3 <configSections> 4 <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > 5 <section name="HeuristicLab.Clients.OKB.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 6 </sectionGroup> 7 </configSections> 3 8 <system.serviceModel> 4 9 <behaviors> … … 63 68 </client> 64 69 </system.serviceModel> 65 <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration> 70 <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup><applicationSettings> 71 <HeuristicLab.Clients.OKB.Properties.Settings> 72 <setting name="EndpointConfigurationPriorities" serializeAs="Xml"> 73 <value> 74 <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 75 xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 76 <string>WSHttpBinding_IQueryService</string> 77 </ArrayOfString> 78 </value> 79 </setting> 80 <setting name="MaxEndpointRetries" serializeAs="String"> 81 <value>3</value> 82 </setting> 83 </HeuristicLab.Clients.OKB.Properties.Settings> 84 </applicationSettings> 85 </configuration>
Note: See TracChangeset
for help on using the changeset viewer.