Skip to content

Commit 0dabddc

Browse files
authored
Merge branch 'netcore' into eform-net-core
2 parents 196052a + ba53a74 commit 0dabddc

File tree

7 files changed

+49
-38
lines changed

7 files changed

+49
-38
lines changed

docs/Linux/install.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ su - eformuser
5050

5151
### Downloading script
5252

53-
Use wget to download script (replace with download link from repository)
53+
Use wget to download script
5454

5555
```bash
5656
wget https://raw.githubusercontent.com/microting/eform-angular-frontend/netcore/install.sh
@@ -97,4 +97,4 @@ All installation process is automated, after installation eFrom application will
9797

9898
## Error solving
9999

100-
If app is not launched or something missing - check __errlog__ file for more info about installation process
100+
If app is not launched or something missing - check __errlog__ file for more info about installation process

eFormAPI/Installation/CustomActions/CustomAction.cs

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
using System.Security.Principal;
1515
using System.Management.Automation;
1616
using System.Net.NetworkInformation;
17+
using System.Xml.Linq;
1718

1819
namespace CustomActions
1920
{
@@ -368,6 +369,14 @@ private static void CopyProtectedData(Session session, string installFolder)
368369
File.Delete(Path.Combine(dst, "System.Security.Cryptography.ProtectedData.dll"));
369370
}
370371
File.Copy(Path.Combine(installFolder, @"bin\System.Security.Cryptography.ProtectedData.dll"), Path.Combine(dst, "System.Security.Cryptography.ProtectedData.dll"));
372+
373+
dst = Path.Combine(installFolder, @"bin\runtimes\win\lib\netcoreapp2.1");
374+
Directory.CreateDirectory(dst);
375+
if (File.Exists(Path.Combine(dst, "System.Data.SqlClient.dll")))
376+
{
377+
File.Delete(Path.Combine(dst, "System.Data.SqlClient.dll"));
378+
}
379+
File.Copy(Path.Combine(installFolder, @"bin\System.Data.SqlClient.dll"), Path.Combine(dst, "System.Data.SqlClient.dll"));
371380
}
372381

373382
[CustomAction]
@@ -397,6 +406,7 @@ public static ActionResult UpdateCA(Session session)
397406

398407
// stop sites
399408
ControlSites(customerNumber, domain, apiPort, uiPort, false);
409+
Thread.Sleep(10000);
400410
IncrementProgressBar(session);
401411

402412
// client update
@@ -449,8 +459,9 @@ public static ActionResult UpdateCA(Session session)
449459

450460
session.Log("AddImageHandlers called");
451461
AddImageHandlers(webApiName, webApiLocation);
452-
IncrementProgressBar(session);
462+
AddAspNetCoreSection(webApiName, webApiLocation);
453463

464+
IncrementProgressBar(session);
454465

455466
session.Log("RunAngularAsWinService called");
456467
RunAngularAsWinService(apiPort, uiPort, uiIisDir, uiName);
@@ -775,21 +786,7 @@ private static void AddImageHandlers(string siteName, string webdataLocation)
775786
ConfigurationSection handlersSection = config.GetSection("system.webServer/handlers");
776787
ConfigurationElementCollection handlersCollection = handlersSection.GetCollection();
777788

778-
ConfigurationSection webserverSection = config.GetSection("system.webserver");
779-
foreach(ConfigurationElement ele in webserverSection.ChildElements)
780-
{
781-
if (ele.ChildElements.Count < 1)
782-
{
783-
webserverSection.GetCollection().Remove(ele);
784-
}
785-
}
786-
787-
ConfigurationElement new_ele = webserverSection.GetCollection().CreateElement("aspNetCore");
788-
new_ele["processPath"] = "dotnet";
789-
new_ele["arguments"] = Path.Combine(webdataLocation, @"bin\eFormAPI.Web.dll");
790-
new_ele["stdoutLogEnabled"] = "false";
791-
new_ele["stdoutLogFile"] = Path.Combine(webdataLocation, @"bin\logs\stdout");
792-
webserverSection.GetCollection().Add(new_ele);
789+
ConfigurationSection webserverSection = null;
793790

794791
List<ConfigurationElement> toRemoveElements = new List<ConfigurationElement>();
795792

@@ -814,9 +811,9 @@ private static void AddImageHandlers(string siteName, string webdataLocation)
814811
handlersCollection.Add(ele);
815812

816813
}
817-
catch
814+
catch (Exception ex)
818815
{
819-
816+
MessageBox.Show("jpgHandlerMissing ex is : " + ex.Message + "stacktrace : " + ex.StackTrace);
820817
}
821818

822819
try
@@ -872,6 +869,29 @@ private static void AddImageHandlers(string siteName, string webdataLocation)
872869
}
873870
}
874871

872+
private static void AddAspNetCoreSection(string siteName, string webdataLocation)
873+
{
874+
875+
XDocument xmlFile = XDocument.Load(Path.Combine(webdataLocation, "web.config"));
876+
var query = from c in xmlFile.Elements("configuration").Elements("location").Elements("system.webServer") select c;
877+
878+
query.First();
879+
880+
if (query.Elements("aspNetCore").Count() != 1)
881+
{
882+
883+
XElement xElement = new XElement("aspNetCore");
884+
xElement.SetAttributeValue("processPath", "dotnet");
885+
xElement.SetAttributeValue("arguments", Path.Combine(webdataLocation, @"bin\eFormAPI.Web.dll"));
886+
xElement.SetAttributeValue("stdoutLogEnabled", "false");
887+
xElement.SetAttributeValue("stdoutLogFile", Path.Combine(webdataLocation, @"bin\logs\stdout"));
888+
query.First().Add(xElement);
889+
890+
xmlFile.Save(Path.Combine(webdataLocation, "web.config"));
891+
}
892+
}
893+
894+
875895
private static void AddRedirectionRules(string siteName, string uiServiceLink)
876896
{
877897
using (ServerManager serverManager = new ServerManager())
@@ -1021,6 +1041,9 @@ private static void DirectoryCopy(string sourceDirName, string destDirName, bool
10211041
if (file.Name.Equals("Web.config", StringComparison.InvariantCultureIgnoreCase) && File.Exists(temppath))
10221042
continue;
10231043

1044+
if (file.Name.Equals("appsettings.json", StringComparison.InvariantCultureIgnoreCase) && File.Exists(temppath))
1045+
continue;
1046+
10241047
if (File.Exists(temppath) && !overrideFile)
10251048
continue;
10261049

eFormAPI/eFormAPI.Web.Integration.Tests/eFormAPI.Web.Integration.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
1010
<PackageReference Include="Microting.eForm" Version="3.0.112" />
1111
<PackageReference Include="NUnit" Version="3.10.1" />
1212
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />

eFormAPI/eFormAPI.Web.Tests/eFormAPI.Web.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
1010
<PackageReference Include="Microting.eForm" Version="3.0.112" />
1111
<PackageReference Include="NUnit" Version="3.10.1" />
1212
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />

eFormAPI/eFormAPI.Web/Services/SitesService.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using AutoMapper;
43
using eFormAPI.Web.Abstractions;
54
using eFormAPI.Web.Abstractions.Advanced;
65
using eFormCore;
@@ -69,24 +68,17 @@ public OperationResult Delete(int id)
6968
{
7069
Core core = _coreHelper.GetCore();
7170
SiteName_Dto siteDto = core.Advanced_SiteItemRead(id);
72-
SiteNameModel siteNameModel;
7371

74-
if (!siteDto.Equals(null))
75-
{
76-
Mapper.Initialize(cfg => cfg.CreateMap<SiteName_Dto, SiteNameModel>());
77-
siteNameModel =
78-
Mapper.Map<SiteName_Dto, SiteNameModel>(siteDto);
79-
}
80-
else
72+
if (siteDto.Equals(null))
8173
{
8274
return new OperationResult(false, _localizationService.GetString("SiteParamNotFound", id));
8375
}
8476

8577
return core.Advanced_SiteItemDelete(id)
8678
? new OperationResult(true,
87-
_localizationService.GetString("SiteParamDeletedSuccessfully", siteNameModel.SiteName))
79+
_localizationService.GetString("SiteParamDeletedSuccessfully", siteDto.SiteName))
8880
: new OperationResult(false,
89-
_localizationService.GetString("SiteParamCouldNotBeDeleted", siteNameModel.SiteName));
81+
_localizationService.GetString("SiteParamCouldNotBeDeleted", siteDto.SiteName));
9082
}
9183

9284
catch (Exception)

eFormAPI/eFormAPI.Web/eFormAPI.Web.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@
2626
</ItemGroup>
2727

2828
<ItemGroup>
29-
<PackageReference Include="Automapper" Version="6.1.0" />
30-
<PackageReference Include="Microting.eForm" Version="3.0.112" />
3129
<PackageReference Include="Microting.eFormApi.BasePn" Version="1.1.70" />
30+
<PackageReference Include="Microting.eForm" Version="3.0.112" />
3231
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.1.4" />
3332
<PackageReference Include="SharpZipLib.NETStandard" Version="1.0.7" />
3433
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-beta0005" />

eFormAPI/eFormAPI.sln

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ Global
5454
{701DF5E7-71CC-4187-835F-2C9E8056956B}.Release|Any CPU.ActiveCfg = Release|Any CPU
5555
{701DF5E7-71CC-4187-835F-2C9E8056956B}.Release|Any CPU.Build.0 = Release|Any CPU
5656
{701DF5E7-71CC-4187-835F-2C9E8056956B}.Release|x64.ActiveCfg = Release|Any CPU
57-
{701DF5E7-71CC-4187-835F-2C9E8056956B}.Release|x64.Build.0 = Release|Any CPU
5857
{701DF5E7-71CC-4187-835F-2C9E8056956B}.Release|x86.ActiveCfg = Release|Any CPU
5958
{701DF5E7-71CC-4187-835F-2C9E8056956B}.Release|x86.Build.0 = Release|Any CPU
6059
{703802AA-5C65-43F0-8DFE-C81954EE7B04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -66,7 +65,6 @@ Global
6665
{703802AA-5C65-43F0-8DFE-C81954EE7B04}.Release|Any CPU.ActiveCfg = Release|Any CPU
6766
{703802AA-5C65-43F0-8DFE-C81954EE7B04}.Release|Any CPU.Build.0 = Release|Any CPU
6867
{703802AA-5C65-43F0-8DFE-C81954EE7B04}.Release|x64.ActiveCfg = Release|Any CPU
69-
{703802AA-5C65-43F0-8DFE-C81954EE7B04}.Release|x64.Build.0 = Release|Any CPU
7068
{703802AA-5C65-43F0-8DFE-C81954EE7B04}.Release|x86.ActiveCfg = Release|Any CPU
7169
{703802AA-5C65-43F0-8DFE-C81954EE7B04}.Release|x86.Build.0 = Release|Any CPU
7270
{608BF97D-0220-4EAC-9BCC-7C3FBC50A7D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -78,7 +76,6 @@ Global
7876
{608BF97D-0220-4EAC-9BCC-7C3FBC50A7D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
7977
{608BF97D-0220-4EAC-9BCC-7C3FBC50A7D6}.Release|Any CPU.Build.0 = Release|Any CPU
8078
{608BF97D-0220-4EAC-9BCC-7C3FBC50A7D6}.Release|x64.ActiveCfg = Release|Any CPU
81-
{608BF97D-0220-4EAC-9BCC-7C3FBC50A7D6}.Release|x64.Build.0 = Release|Any CPU
8279
{608BF97D-0220-4EAC-9BCC-7C3FBC50A7D6}.Release|x86.ActiveCfg = Release|Any CPU
8380
{608BF97D-0220-4EAC-9BCC-7C3FBC50A7D6}.Release|x86.Build.0 = Release|Any CPU
8481
{768280FF-C359-4E58-8B5C-1F682B41CC24}.Debug|Any CPU.ActiveCfg = Debug|x86

0 commit comments

Comments
 (0)